From e205acae3c7605bae79dd5f661dbd7820572fa85 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Tue, 28 Sep 2021 13:08:28 +0530 Subject: [PATCH 01/78] feat: handle timeout and deadlocks in db.sql --- frappe/database/database.py | 4 ++++ frappe/exceptions.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/frappe/database/database.py b/frappe/database/database.py index c48e86d301..61eeac950f 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -158,6 +158,10 @@ class Database(object): # only for mariadb frappe.errprint('Syntax error in query:') frappe.errprint(query) + elif self.is_deadlocked(e) or self.is_timedout(e): + err_msg = _('There was a problem accessing required resources to complete the transaction. Please retry.') + exception = frappe.QueryTimeout if self.is_timedout(e) else frappe.QueryDeadlock + frappe.throw(msg=err_msg, title=_('Request Timeout'), exc=exception) if ignore_ddl and (self.is_missing_column(e) or self.is_missing_table(e) or self.cant_drop_field_or_key(e)): pass diff --git a/frappe/exceptions.py b/frappe/exceptions.py index 31a94ac883..6c063127c2 100644 --- a/frappe/exceptions.py +++ b/frappe/exceptions.py @@ -101,6 +101,8 @@ class DataTooLongException(ValidationError): pass class FileAlreadyAttachedException(Exception): pass class DocumentAlreadyRestored(Exception): pass class AttachmentLimitReached(Exception): pass +class QueryTimeout(ValidationError): pass +class QueryDeadlock(ValidationError): pass # OAuth exceptions class InvalidAuthorizationHeader(CSRFTokenError): pass class InvalidAuthorizationPrefix(CSRFTokenError): pass From 4109caf1bfee2687ad0d8dbe82cc42f4ee5435c6 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Tue, 28 Sep 2021 16:15:24 +0530 Subject: [PATCH 02/78] chore: improve message & title --- frappe/database/database.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frappe/database/database.py b/frappe/database/database.py index 61eeac950f..1325ad166a 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -158,10 +158,14 @@ class Database(object): # only for mariadb frappe.errprint('Syntax error in query:') frappe.errprint(query) - elif self.is_deadlocked(e) or self.is_timedout(e): - err_msg = _('There was a problem accessing required resources to complete the transaction. Please retry.') - exception = frappe.QueryTimeout if self.is_timedout(e) else frappe.QueryDeadlock - frappe.throw(msg=err_msg, title=_('Request Timeout'), exc=exception) + elif self.is_deadlocked(e): + err_msg = _('There was a problem accessing required resources to complete the transaction.') + '
' + err_msg += _('Please try again.') + frappe.throw(msg=err_msg, title=_('Deadlock Occurred'), exc=frappe.QueryDeadlock) + elif self.is_timedout(e): + err_msg = _('There was a problem accessing required resources to complete the transaction.') + '
' + err_msg += _('Please try again.') + frappe.throw(msg=err_msg, title=_('Request Timeout'), exc=frappe.QueryTimeout) if ignore_ddl and (self.is_missing_column(e) or self.is_missing_table(e) or self.cant_drop_field_or_key(e)): pass From d04016d274195060bbe0d9e47f2a7e7803ff1372 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 4 Oct 2021 21:57:10 +0530 Subject: [PATCH 03/78] fix: Fixed css for Primary Navbar template --- frappe/website/web_template/primary_navbar/primary_navbar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/website/web_template/primary_navbar/primary_navbar.html b/frappe/website/web_template/primary_navbar/primary_navbar.html index 5d7267706a..b18ff6e81f 100644 --- a/frappe/website/web_template/primary_navbar/primary_navbar.html +++ b/frappe/website/web_template/primary_navbar/primary_navbar.html @@ -1,4 +1,4 @@ -