Skip to content

Commit

Permalink
queue_job: triggers stored computed fields before calling 'set_done()'
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sebalix committed Mar 27, 2024
1 parent b0f5b60 commit f859a4e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions queue_job/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Check warning on line 39 in queue_job/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

queue_job/controllers/main.py#L39

Added line #L39 was not covered by tests
job.set_done()
job.store()
env.flush_all()
Expand Down

0 comments on commit f859a4e

Please sign in to comment.