Repository navigation
Conversation
6 of 7 tasks
janbjorge
force-pushed
the
fix/keep-unwritten-job-ends
branch
from
October 24, 2026 14:00
99c2fbf to
c4ca5b6
Compare
A dead connection drops the status write, so a finished job stays picked and runs again. The ends now stay on the manager, and an in-process restart writes them on the next connection. Fixes #1027.
janbjorge
force-pushed
the
fix/keep-unwritten-job-ends
branch
from
October 24, 2026 14:06
c4ca5b6 to
3fad41c
Compare
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1027.
Stacked on the supervisor refactor. That PR introduces the list. This one fills it.
Summary
QueueManager.unwritten_job_logs. Copy the list off before the nextrun, and write it withlog_jobson a live connection. A write after another worker owns the job is ignored.pgq run --restart-on-failurewrites those ends on the next connection before it dequeues. A new process does not have the list, so those jobs still run again, as ADR-0004 allows.Testing
uv sync --frozen && uv run ruff check . && uv run ruff format . --check && uv run lint-imports && uv run mypy . && uv run pytestpassedtest_run_keeps_job_end_when_shutdown_flush_failskeeps asuccessfulend when the exit flush raises, and a laterlog_jobsremoves the rowtest_restart_writes_job_end_the_first_run_could_notwrites that end on the restarted connection, and the handler does not run a second timeuv run ruff check,uv run mypyon the touched files passedChecklist