diff --git a/frappe/database/database.py b/frappe/database/database.py index 2b3e43422f..002deaf9a7 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -475,6 +475,9 @@ class Database: if query_type in WRITE_QUERY_TYPES: self.transaction_writes += 1 + if frappe.conf.get("max_writes_per_transaction"): + self.MAX_WRITES_PER_TRANSACTION = cint(frappe.conf.max_writes_per_transaction) + if self.transaction_writes > self.MAX_WRITES_PER_TRANSACTION: if self.auto_commit_on_many_writes: self.commit()