From acf398f46ecbd0cad1270ec41d11c759f1ceb54d Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 11 Mar 2024 15:18:38 +0530 Subject: [PATCH] fix: commit regardless of framework's transaction_writes count (#25322) - There is code that depends on "commit", everything that happens with `db.after_commit`. - There are operations that will not write anything to DB but just enqueue the function, if it's enqueue_after_commit then it will break. --- frappe/app.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frappe/app.py b/frappe/app.py index 61f626bfcd..555752a13b 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -399,11 +399,7 @@ def handle_exception(e): def sync_database(rollback: bool) -> bool: # if HTTP method would change server state, commit if necessary - if ( - frappe.db - and (frappe.local.flags.commit or frappe.local.request.method in UNSAFE_HTTP_METHODS) - and frappe.db.transaction_writes - ): + if frappe.db and (frappe.local.flags.commit or frappe.local.request.method in UNSAFE_HTTP_METHODS): frappe.db.commit() rollback = False elif frappe.db: