From 2849da71adb020748b2db1712094e4f4ef9d4864 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 11 Sep 2014 16:11:53 +0530 Subject: [PATCH] [fix] notification count deletion deadlock --- .../doctype/notification_count/notification_count.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frappe/core/doctype/notification_count/notification_count.py b/frappe/core/doctype/notification_count/notification_count.py index 28bd0e2ea6..fbb8ae4718 100644 --- a/frappe/core/doctype/notification_count/notification_count.py +++ b/frappe/core/doctype/notification_count/notification_count.py @@ -89,7 +89,15 @@ def clear_notifications(user=None): def delete_notification_count_for(doctype): if frappe.flags.in_import: return - frappe.db.sql("""delete from `tabNotification Count` where for_doctype = %s""", (doctype,)) + + try: + frappe.db.sql("""delete from `tabNotification Count` where for_doctype = %s""", (doctype,)) + + except MySQLdb.OperationalError, e: + if e.args[0] != 1213: + raise + + logger.error("Deadlock") def clear_doctype_notifications(doc, method=None, *args, **kwargs): if frappe.flags.in_import: