From f859a4ee8f77410d0508761c8549ce9fe679e8d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Wed, 27 Mar 2024 12:35:26 +0100 Subject: [PATCH] queue_job: triggers stored computed fields before calling 'set_done()' So the time required to compute such fields by the ORM is taken into account when the 'date_done' and 'exec_time' values are set on the job. --- queue_job/controllers/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/queue_job/controllers/main.py b/queue_job/controllers/main.py index 0e58e52628..0338c823c5 100644 --- a/queue_job/controllers/main.py +++ b/queue_job/controllers/main.py @@ -34,6 +34,9 @@ def _try_perform_job(self, env, job): _logger.debug("%s started", job) job.perform() + # Triggers any stored computed fields before calling 'set_done' + # so that will be part of the 'exec_time' + env["base"].flush() job.set_done() job.store() env.flush_all()