Skip to content

fix(queue): bound the maintenance lane so a retry storm cannot re-saturate it#1283

Merged
JSONbored merged 1 commit into
mainfrom
fix/bound-maintenance-lane
Jun 24, 2026
Merged

fix(queue): bound the maintenance lane so a retry storm cannot re-saturate it#1283
JSONbored merged 1 commit into
mainfrom
fix/bound-maintenance-lane

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

The shared gittensory-jobs consumer had no max_concurrency (Cloudflare may fan out many concurrent consumers, each pulling a heavy sweep/backfill batch — amplifying GitHub-rate pressure) and no retry_delay (a failed job re-delivers immediately, re-hammering the already-overloaded path). This is the magnitude half of the overload (Flaw B). Now that webhooks have their own lane (#1276), bound this maintenance lane:

  • max_batch_size 5 (was 10): a batch can't bundle as many heavy jobs at once.
  • max_concurrency 3: bounded fan-out — drains metagraphed's worst sweep (50 PRs) within the 2-min cron interval without flooding the shared installation rate bucket.
  • retry_delay 30: back off a failed job 30s instead of re-hammering instantly.

Webhooks are unaffected (their own lane). A follow-up may tighten max_concurrency to 2 once the sweep fans into tiny per-PR jobs.

Scope

  • wrangler.jsonc only — consumer config on the existing gittensory-jobs queue. No new binding, no DB migration, no src change (so no coverage obligation).

Validation

  • Values verified against the documented Cloudflare Queues consumer options (max_concurrency, retry_delay, max_batch_size) via the Cloudflare docs — all within limits
  • npx wrangler deploy --dry-run succeeds (config parses + builds); cf-typegen produces no binding-type change; tsc clean
  • Rebased onto latest main immediately before opening · reversible config-only change

Safety

  • No secrets / wallets / hotkeys / trust scores / reward values; no site/ / CNAME / lovable; no changelog edit

…urate it

The shared gittensory-jobs consumer had no max_concurrency (Cloudflare may fan
out many concurrent consumers each pulling a heavy sweep/backfill batch,
amplifying GitHub-rate pressure) and no retry_delay (a failed job re-delivers
immediately, re-hammering the already-overloaded path). Now that webhooks have
their own lane, bound this maintenance lane:

  - max_batch_size 5 (was 10): a batch can't bundle as many heavy jobs at once.
  - max_concurrency 3: bounded fan-out — drains metagraphed's worst sweep within
    the 2-min cron interval without flooding the shared installation rate bucket.
  - retry_delay 30: back off a failed job 30s instead of re-hammering instantly.

Webhooks are unaffected (their own lane). A follow-up may tighten max_concurrency
to 2 once the sweep fans into tiny per-PR jobs.
@dosubot dosubot Bot added the size:S label Jun 24, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored
JSONbored merged commit 5bf888b into main Jun 24, 2026
14 checks passed
@JSONbored
JSONbored deleted the fix/bound-maintenance-lane branch June 24, 2026 23:18
galuis116 pushed a commit to galuis116/gittensory that referenced this pull request Jul 19, 2026
JSONbored#4892 asked to make the hosted loopover-jobs queue's Cloudflare Queues
consumer settings (max_batch_size/max_concurrency/max_retries/retry_delay)
runtime-configurable and re-derive better defaults. Neither half is
actually achievable right now: these are consumer-binding attributes
Cloudflare's control plane reads at `wrangler deploy` time, before any
Worker code runs -- there's no env-var override mechanism for them, and
re-deriving new defaults needs real production job-volume data this
worktree has no access to.

What's real and worth doing: the existing comment justified the current
values against one specific repo's historical incident (JSONbored#1283,
"metagraphed's worst sweep"). Rewrites it as a durable, formula-based
constraint (max_batch_size × max_concurrency bounds concurrent in-flight
GitHub calls against one installation's rate-limit headroom) so a future
re-tune starts from a stated principle instead of one repo's sizing.

No literal value changed -- verified via `wrangler deploy --dry-run`.

Advances JSONbored#4892
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