fix: Avoid killing any system threads (#31442)
This commit is contained in:
parent
8baeb5151d
commit
7110e79926
1 changed files with 2 additions and 0 deletions
|
|
@ -209,6 +209,7 @@ class SiteMigration:
|
|||
connection_id = frappe.db.sql("select connection_id()")[0][0]
|
||||
for process in processes:
|
||||
sleeping = process.get("Command") == "Sleep"
|
||||
user = str(process.get("User")).lower()
|
||||
sleeping_since = cint(process.get("Time")) or 0
|
||||
pid = process.get("Id")
|
||||
|
||||
|
|
@ -218,6 +219,7 @@ class SiteMigration:
|
|||
and process.db == frappe.conf.db_name
|
||||
and sleeping
|
||||
and sleeping_since > idle_limit
|
||||
and user != "system user"
|
||||
):
|
||||
try:
|
||||
frappe.db.sql(f"kill {pid}")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue