fix: Avoid indefinitely waiting for metadata locks
This commit is contained in:
parent
2a5c778235
commit
e67bbf8bb8
1 changed files with 8 additions and 0 deletions
|
|
@ -84,6 +84,7 @@ class SiteMigration:
|
|||
if os.path.exists(self.touched_tables_file):
|
||||
os.remove(self.touched_tables_file)
|
||||
|
||||
self.lower_lock_timeout()
|
||||
frappe.flags.in_migrate = True
|
||||
|
||||
def tearDown(self):
|
||||
|
|
@ -185,6 +186,13 @@ class SiteMigration:
|
|||
|
||||
return are_services_running
|
||||
|
||||
def lower_lock_timeout(self):
|
||||
"""Lower timeout for table metadata locks, default is 1 day, reduce it to 5 minutes.
|
||||
|
||||
This is required to avoid indefinitely waiting for metadata lock.
|
||||
"""
|
||||
frappe.db.sql("set session lock_wait_timeout = %s", 5 * 60)
|
||||
|
||||
def run(self, site: str):
|
||||
"""Run Migrate operation on site specified. This method initializes
|
||||
and destroys connections to the site database.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue