fix: patch QB before setup_module_map (#24981)
This function if cache isn't available CAN result in a DB query, this will cause cold starts to fail because QB is not yet patched.
This commit is contained in:
parent
f027a03dcf
commit
3aa7fd77ed
2 changed files with 2 additions and 3 deletions
|
|
@ -300,12 +300,13 @@ def init(site: str, sites_path: str = ".", new_site: bool = False, force=False)
|
|||
local.qb = get_query_builder(local.conf.db_type)
|
||||
local.qb.get_query = get_query
|
||||
setup_redis_cache_connection()
|
||||
setup_module_map(include_all_apps=not (frappe.request or frappe.job or frappe.flags.in_migrate))
|
||||
|
||||
if not _qb_patched.get(local.conf.db_type):
|
||||
patch_query_execute()
|
||||
patch_query_aggregation()
|
||||
|
||||
setup_module_map(include_all_apps=not (frappe.request or frappe.job or frappe.flags.in_migrate))
|
||||
|
||||
local.initialised = True
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ def patch_query_execute():
|
|||
# To support running union queries
|
||||
_SetOperation.run = execute_query
|
||||
_SetOperation.walk = prepare_query
|
||||
frappe._qb_patched[frappe.conf.db_type] = True
|
||||
|
||||
|
||||
def patch_query_aggregation():
|
||||
|
|
@ -149,4 +148,3 @@ def patch_query_aggregation():
|
|||
frappe.qb.min = _min
|
||||
frappe.qb.avg = _avg
|
||||
frappe.qb.sum = _sum
|
||||
frappe._qb_patched[frappe.conf.db_type] = True
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue