Repository navigation
Prevent deferred worker items from starving ready work - #51
Open
Thom Chiovoloni (thomcc-work) wants to merge 2 commits into
Open
Thom Chiovoloni (thomcc-work) wants to merge 2 commits into
Thom Chiovoloni (thomcc-work) wants to merge 2 commits into
Conversation
Order eligible worker items by visibility time, then queue ID, so expired deferrals cannot repeatedly overtake work that was already ready. Add migration 0027 and a matching index, preserving session ownership, tag filtering, locking, and attempt accounting. Add regression tests for session/non-session and tagged/untagged work, and document rollout impact.
5 of 7 tasks
Renumber the migration to 0029 and add its baseline-0016 diff. Centralize rollout guidance, including concurrent index preparation and the SHARE lock retained even when the build is skipped. Reject invalid prebuilt indexes without changing the migration ledger, fetch function, or queued work. Add red/green regression coverage, enforce unique increasing embedded versions in a unit test, refresh the embed marker, and reuse panic-safe test schema cleanup. Validation: 301 related unit, provider, and migration tests passed (one skipped); targeted regressions passed from fresh Cargo target directories. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Thom Chiovoloni (thomcc-work)
force-pushed
the
activity-admission-progress
branch
from
October 30, 2026 16:54
aca6832 to
9ae067b
Compare
Thom Chiovoloni (thomcc-work)
added a commit
that referenced
this pull request
Nov 2, 2026
Keep the database message in ordinary migration error display while retaining the SQLx source for SQLSTATE retry classification. Add a red/green regression that also proves failed migration statements leave the ledger, stored function, and durable rows unchanged. State that migration 0030 must not ship before the 0027-0029 prerequisites, including the dependency of #51 on #32. Addresses review items 41-N6 and 41-N7. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Thom Chiovoloni (thomcc-work)
added a commit
that referenced
this pull request
Nov 2, 2026
Match #51's associated load_migrations and parse_version functions, including the failed-unlock regression added by #41. This keeps the standalone branch buildable and avoids E0599 when the prerequisite changes are combined. Retain b33a3f2's connection-reuse behavior without changing pool sizing or tuning for the upstream barrier-based test. Addresses review item 41-N11. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Prevent a backlog of deferred activities from starving unrelated ready work.
Previously, worker fetches selected eligible rows by queue ID alone. Deferred
items retained their original IDs, so if their retry delays expired before the
backlog drained, they could repeatedly be selected ahead of newer ready work.
Migration
0027changes both session-aware and non-session fetches to ordereligible rows by
visible_at, id. A deferred item therefore goes behind workthat was already ready, even after its delay expires.
worker_queue(visible_at, id).This is the PostgreSQL-provider companion to microsoft/duroxide#74. It does
not change activity admission APIs or introduce a Duroxide dependency bump.
Migration and compatibility
fetch_work_itemwithout changing its signature or return shape.Plan migration time accordingly for large queues.
reject the new migration version on startup, so coordinate migration and
worker rollout.