fix: Make make_access_log write only
Write to primary db if connection is currently set to replica
This commit is contained in:
parent
61d067710f
commit
70ac05025b
2 changed files with 2 additions and 1 deletions
|
|
@ -633,11 +633,11 @@ def write_only():
|
|||
# if replica connection exists, we have to replace it momentarily with the primary connection
|
||||
def innfn(fn):
|
||||
def wrapper_fn(*args, **kwargs):
|
||||
# switch to primary connection
|
||||
primary_db = getattr(local, "primary_db", None)
|
||||
replica_db = getattr(local, "replica_db", None)
|
||||
in_read_only = getattr(local, "db", None) != primary_db
|
||||
|
||||
# switch to primary connection
|
||||
if in_read_only and primary_db:
|
||||
local.db = local.primary_db
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class AccessLog(Document):
|
|||
|
||||
|
||||
@frappe.whitelist()
|
||||
@frappe.write_only()
|
||||
def make_access_log(doctype=None, document=None, method=None, file_type=None,
|
||||
report_name=None, filters=None, page=None, columns=None):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue