Skip to content

Commit

Permalink
[IMP] queue_job: increment 'retry' when re-queuing job that have been…
Browse files Browse the repository at this point in the history
… killed
  • Loading branch information
AnizR committed Dec 6, 2024
1 parent 3cb2a4e commit b0f9f59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions queue_job/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@ def perform(self):
The job is executed with the user which has initiated it.
"""
if self.max_retries and self.retry >= self.max_retries:
raise FailedJobError("Max. retries (%d) reached" % (self.max_retries))

Check warning on line 546 in queue_job/job.py

View check run for this annotation

Codecov / codecov/patch

queue_job/job.py#L546

Added line #L546 was not covered by tests

self.retry += 1
try:
self.result = self.func(*tuple(self.args), **self.kwargs)
Expand Down
3 changes: 2 additions & 1 deletion queue_job/jobrunner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ def reset_dead_jobs(self):
UPDATE
queue_job
SET
state='pending'
state='pending',
retry=retry+1
WHERE
id IN (
SELECT
Expand Down

0 comments on commit b0f9f59

Please sign in to comment.