fix: reload Prepared Report before save to avoid TimestampMismatchError

This commit is contained in:
Kaushal Shriwas 2026-03-24 20:31:53 +05:30
parent 7e6c9def71
commit c5164d0150

View file

@ -141,7 +141,10 @@ def generate_report(prepared_report):
except Exception: except Exception:
# we need to ensure that error gets stored # we need to ensure that error gets stored
_save_error(instance, error=frappe.get_traceback(with_context=True)) _save_error(instance, error=frappe.get_traceback(with_context=True))
return
instance.reload()
instance.status = "Completed"
instance.report_end_time = frappe.utils.now() instance.report_end_time = frappe.utils.now()
instance.peak_memory_usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss instance.peak_memory_usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
add_data_to_monitor(peak_memory_usage=instance.peak_memory_usage) add_data_to_monitor(peak_memory_usage=instance.peak_memory_usage)