Skip to content

Confine claim recovery to the worker loop and fence shared claims - #117

Merged
PhiLily merged 1 commit into
mainfrom
fix/claim-recovery-scope
Sep 28, 2026
Merged

PhiLily merged 1 commit into
mainfrom
fix/claim-recovery-scope

Conversation

@PhiLily

@PhiLily PhiLily commented Sep 28, 2026

Copy link
Copy Markdown
Member
  • What and why: Narrow and complete the unreleased recovery work on main. Confine recovery to Worker.run() on PostgreSQL with psycopg 3, MySQL and SQLite; restore Worker.run_once() and testing.run_tasks() to 1.6.0 behavior on claim errors and exclude psycopg2. Fence recovery against concurrent claims through returned-row registration, including subclass work, without holding a lock across a claim or a database call. Shared-Worker claims remain concurrent. Give a Worker inherited across a fork a new child id and fresh bookkeeping so recovery cannot release the other process's running task. Document fork restrictions, recovery limits, stop-time waiting and stable log events. No database migration is required.
  • Tests: ran on SQLite and PostgreSQL (see CONTRIBUTING.md); new behavior is covered. Tests cover each behavior the fix changes. run_once() and testing.run_tasks() match 1.6.0 statement for statement across 49 scenarios.
  • Changelog: update the unreleased Fixed, Changed and Added entries to describe the completed recovery behavior, fork identity handling and stable log contract, including exclusions and shutdown caveats.

@PhiLily
PhiLily force-pushed the fix/claim-recovery-scope branch from f2068c0 to 50e5cef Compare September 28, 2026 08:23
Narrow and complete the unreleased recovery work on main.
Recover unconfirmed claims only in Worker.run() on PostgreSQL with
psycopg 3, MySQL and SQLite. Restore run_once() and testing.run_tasks()
to 1.6.0 behavior on claim errors, and exclude psycopg2 from recovery.

Fence recovery against concurrent claims without holding a lock
across a claim or a database call. Track claims through registration,
including subclass work after the base claim returns. Keep shared
Worker claims concurrent and defer recovery when a claim is in flight.

Give a Worker inherited across a fork a new child id, empty claim
bookkeeping and fresh locks. Retain the slot suffix and document
the inherited heartbeat path and unsupported claimed-row handoff.

Complete stop-time recovery limits, stable recovery log events and
documentation. A recovery error does not prevent shutdown; the
recovery waiting limits do not bound shutdown as a whole.

Tests cover each behavior the fix changes.
@PhiLily
PhiLily force-pushed the fix/claim-recovery-scope branch from 50e5cef to f4f2ae3 Compare September 28, 2026 09:08
@PhiLily
PhiLily merged commit 14db948 into main Sep 28, 2026
35 checks passed
@PhiLily
PhiLily deleted the fix/claim-recovery-scope branch September 28, 2026 09:28
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.

1 participant