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: