Hi everyone,
I’m running into an issue while updating a document through a background job.
Here’s the relevant part of my code:
patient_doc.reload()
patient_doc.save(ignore_permissions=True, ignore_version=True)
frappe.db.commit()
Even though I’m reloading the document and using ignore_version=True, I’m still getting the following error:
frappe.exceptions.TimestampMismatchError:
Error: Document has been modified after you have opened it
(2025-10-09 17:30:16.532997, 2025-10-09 17:30:16.781730).
Please refresh to get the latest document.
It looks like another process might be updating the same record around the same time, but I assumed reload() would handle this.
Is there any recommended way to handle this scenario in background jobs or async operations?
Do I need to disable timestamp checking explicitly, or is there a safe approach to prevent this conflict (like a lock or retry mechanism)?