From 9343db144b9fb54963da0675f50a72cd5fde604d 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 1b35c1ac99..aaa465fb87 100644 --- a/queue_job/controllers/main.py +++ b/queue_job/controllers/main.py @@ -30,6 +30,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["base"].flush()