perf: use cached workflow doc for transitions (#21300)
* fix: expire `RECORDER_INTERCEPT_FLAG` in one hour Leaving this running in prod can be dangerous. * perf: Use cached doc in workflows
This commit is contained in:
parent
345da6e314
commit
774a75dbde
2 changed files with 2 additions and 2 deletions
|
|
@ -210,7 +210,7 @@ def validate_workflow(doc):
|
||||||
|
|
||||||
|
|
||||||
def get_workflow(doctype) -> "Workflow":
|
def get_workflow(doctype) -> "Workflow":
|
||||||
return frappe.get_doc("Workflow", get_workflow_name(doctype))
|
return frappe.get_cached_doc("Workflow", get_workflow_name(doctype))
|
||||||
|
|
||||||
|
|
||||||
def has_approval_access(user, doc, transition):
|
def has_approval_access(user, doc, transition):
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ def status(*args, **kwargs):
|
||||||
@do_not_record
|
@do_not_record
|
||||||
@administrator_only
|
@administrator_only
|
||||||
def start(*args, **kwargs):
|
def start(*args, **kwargs):
|
||||||
frappe.cache.set_value(RECORDER_INTERCEPT_FLAG, 1)
|
frappe.cache.set_value(RECORDER_INTERCEPT_FLAG, 1, expires_in_sec=60 * 60)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue