perf: enable client side caching for recorder flag
This commit is contained in:
parent
796e51df62
commit
a3c48da7f4
1 changed files with 6 additions and 3 deletions
|
|
@ -175,8 +175,11 @@ def normalize_query(query: str) -> str:
|
|||
|
||||
|
||||
def record(force=False):
|
||||
if frappe.cache.get_value(RECORDER_INTERCEPT_FLAG) or force:
|
||||
if frappe.client_cache.get_value(RECORDER_INTERCEPT_FLAG) or force:
|
||||
frappe.local._recorder = Recorder(force=force)
|
||||
elif frappe.client_cache.get_value(RECORDER_INTERCEPT_FLAG) is None:
|
||||
# Explicitly set it once so next requests can use client-side cache
|
||||
frappe.client_cache.set_value(RECORDER_INTERCEPT_FLAG, False)
|
||||
|
||||
|
||||
def dump():
|
||||
|
|
@ -342,14 +345,14 @@ def start(
|
|||
request_filter=request_filter,
|
||||
jobs_filter=jobs_filter,
|
||||
).store()
|
||||
frappe.cache.set_value(RECORDER_INTERCEPT_FLAG, 1, expires_in_sec=RECORDER_AUTO_DISABLE)
|
||||
frappe.client_cache.set_value(RECORDER_INTERCEPT_FLAG, True)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
@do_not_record
|
||||
@administrator_only
|
||||
def stop(*args, **kwargs):
|
||||
frappe.cache.delete_value(RECORDER_INTERCEPT_FLAG)
|
||||
frappe.client_cache.set_value(RECORDER_INTERCEPT_FLAG, False)
|
||||
frappe.enqueue(post_process, now=frappe.flags.in_test)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue