From 7110e79926f4ac16994d34aaf375eec8ff6250c7 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 26 Feb 2025 21:37:46 +0530 Subject: [PATCH] fix: Avoid killing any system threads (#31442) --- frappe/migrate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frappe/migrate.py b/frappe/migrate.py index 9251b5b5f4..ad44316772 100644 --- a/frappe/migrate.py +++ b/frappe/migrate.py @@ -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}")