Skip to content

fix(job-queue): retry promptly when an idle peek finds a ready job - #712

Merged
sroussey merged 1 commit into
mainfrom
claude/supabase-job-queue-timeout-ah7s0e
Aug 7, 2026
Merged

fix(job-queue): retry promptly when an idle peek finds a ready job#712
sroussey merged 1 commit into
mainfrom
claude/supabase-job-queue-timeout-ah7s0e

Conversation

@sroussey

@sroussey sroussey commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

A worker that woke on a submit notify claims before the job's visible_at
deadline and peeks after it, so getIdleDelay saw an already-visible head
job and returned the full poll interval — stranding claimable work for
the whole interval. This is what made the Supabase fast-wake test flaky
in CI: with a 60s poll interval and PGlite round trips slower than the
200ms deferral under load, the deferred job was never picked up and the
test timed out at 5s.

Treat an already-visible head job as "retry soon" instead, backing off
exponentially from 5ms up to the poll interval so a head job that stays
visible-but-unclaimable (clock skew between worker and storage) degrades
to plain polling rather than spinning on the backend.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_012sCJvLZjRzfQ8c2epuEmm5

A worker that woke on a submit notify claims before the job's visible_at
deadline and peeks after it, so getIdleDelay saw an already-visible head
job and returned the full poll interval — stranding claimable work for
the whole interval. This is what made the Supabase fast-wake test flaky
in CI: with a 60s poll interval and PGlite round trips slower than the
200ms deferral under load, the deferred job was never picked up and the
test timed out at 5s.

Treat an already-visible head job as "retry soon" instead, backing off
exponentially from 5ms up to the poll interval so a head job that stays
visible-but-unclaimable (clock skew between worker and storage) degrades
to plain polling rather than spinning on the backend.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sCJvLZjRzfQ8c2epuEmm5
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 64.43% 31808 / 49363
🔵 Statements 64.24% 32910 / 51228
🔵 Functions 65.5% 5985 / 9137
🔵 Branches 53.45% 16414 / 30704
File CoverageNo changed files found.
Generated in workflow #2902 for commit 3431d98 by the Vitest Coverage Report Action

@sroussey
sroussey merged commit 14e4130 into main Aug 7, 2026
14 checks passed
@sroussey
sroussey deleted the claude/supabase-job-queue-timeout-ah7s0e branch August 7, 2026 05:19
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.

2 participants