perf: store touched_tables in local var

This commit is contained in:
Sagar Vora 2025-03-15 13:47:45 +05:30
parent 521ff071ae
commit fb0e2baa5a

View file

@ -1424,9 +1424,13 @@ class Database:
for regex in (SINGLE_WORD_PATTERN, MULTI_WORD_PATTERN):
tables += [groups[1] for groups in regex.findall(query)]
if frappe.flags.touched_tables is None:
frappe.flags.touched_tables = set()
frappe.flags.touched_tables.update(tables)
touched_tables = frappe.local.flags.touched_tables
if touched_tables is None:
touched_tables = set()
frappe.local.flags.touched_tables = touched_tables
touched_tables.update(tables)
def bulk_insert(
self,