Skip to content

fix: mark jobs failed and audit when the job queue is unavailable (#21) - #22

Merged
danishkumar26 merged 1 commit into
mainfrom
fix/issue-21-job-queued-when-enqueue-fails
Nov 28, 2026
Merged

danishkumar26 merged 1 commit into
mainfrom
fix/issue-21-job-queued-when-enqueue-fails

Conversation

@danishkumar26

Copy link
Copy Markdown
Owner

Job submission committed the job row as "queued" before enqueuing to Redis. When enqueue failed (queue down), the error surfaced as an HTTP 500 and the job was stranded in "queued" forever with no audit entry or recovery path (issue #21).

Wrap enqueue in the submission: on failure mark the job "failed", write a job.execute.failed audit entry with the error, and return HTTP 503 so the caller can see and re-submit the job once the queue is back.

Validation: ruff, ruff format, mypy clean; pytest 57 passed (incl. new regression test that fails on unfixed code).

Fixes #21

Job submission committed the job row as "queued" before enqueuing to Redis.
When enqueue failed (queue down), the exception surfaced as an HTTP 500 and
the job was stranded in "queued" forever with no audit entry or recovery
path.

Wrap enqueue in the submission: on failure mark the job "failed", write a
job.execute.failed audit entry with the error, and return HTTP 503 so the
caller can see and re-submit the job once the queue is back.

Adds a regression test. ruff, ruff format, mypy, pytest all clean
(57 passed).

Fixes #21
@danishkumar26
danishkumar26 merged commit 029821a into main Nov 28, 2026
8 checks passed
@danishkumar26
danishkumar26 deleted the fix/issue-21-job-queued-when-enqueue-fails branch November 28, 2026 21:07
danishkumar26 pushed a commit that referenced this pull request Nov 28, 2026
…1-28

Job submission now fails closed when the Redis queue is unavailable:
the job is marked failed, a job.execute.failed audit entry is written,
and the caller receives HTTP 503 instead of a stranded "queued" job.
See PR #22 / issue #21.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Job submission strands job in 'queued' when Redis/enqueue fails, with no audit or recovery path

1 participant