fix: always defer access log insertion (#32976)
This commit is contained in:
parent
514a9a6e59
commit
e355a175d8
1 changed files with 2 additions and 12 deletions
|
|
@ -54,13 +54,10 @@ def make_access_log(
|
|||
page=None,
|
||||
columns=None,
|
||||
):
|
||||
user = frappe.session.user
|
||||
in_request = frappe.request and frappe.request.method == "GET"
|
||||
|
||||
access_log = frappe.get_doc(
|
||||
{
|
||||
"doctype": "Access Log",
|
||||
"user": user,
|
||||
"user": frappe.session.user,
|
||||
"export_from": doctype,
|
||||
"reference_document": document,
|
||||
"file_type": file_type,
|
||||
|
|
@ -72,18 +69,11 @@ def make_access_log(
|
|||
}
|
||||
)
|
||||
|
||||
if frappe.flags.read_only:
|
||||
if not frappe.in_test:
|
||||
access_log.deferred_insert()
|
||||
return
|
||||
else:
|
||||
access_log.db_insert()
|
||||
|
||||
# `frappe.db.commit` added because insert doesnt `commit` when called in GET requests like `printview`
|
||||
# dont commit in test mode. It must be tempting to put this block along with the in_request in the
|
||||
# whitelisted method...yeah, don't do it. That part would be executed possibly on a read only DB conn
|
||||
if not frappe.in_test or in_request:
|
||||
frappe.db.commit()
|
||||
|
||||
|
||||
# only for backward compatibility
|
||||
_make_access_log = make_access_log
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue