fix: better job naming for enqueue_doc (#21755)
DocType.method instead of frappe.utils.background_jobs.run_doc_method
This commit is contained in:
parent
fb2ab0b5be
commit
ebacca3863
1 changed files with 7 additions and 1 deletions
|
|
@ -115,7 +115,13 @@ class RQJob(Document):
|
|||
|
||||
def serialize_job(job: Job) -> frappe._dict:
|
||||
modified = job.last_heartbeat or job.ended_at or job.started_at or job.created_at
|
||||
job_name = job.kwargs.get("kwargs", {}).get("job_type") or str(job.kwargs.get("job_name"))
|
||||
job_kwargs = job.kwargs.get("kwargs", {})
|
||||
job_name = job_kwargs.get("job_type") or str(job.kwargs.get("job_name"))
|
||||
if job_name == "frappe.utils.background_jobs.run_doc_method":
|
||||
doctype = job_kwargs.get("doctype")
|
||||
doc_method = job_kwargs.get("doc_method")
|
||||
if doctype and doc_method:
|
||||
job_name = f"{doctype}.{doc_method}"
|
||||
|
||||
# function objects have this repr: '<function functionname at 0xmemory_address >'
|
||||
# This regex just removes unnecessary things around it.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue