Skip to content

Commit 6147fce

Browse files
authored
Merge pull request #7205 from JSONbored/worktree-queue-tuning-docs
docs(queue): document the real constraint on the hosted queue's tuning
2 parents cc3a201 + 1e381fb commit 6147fce

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

wrangler.jsonc

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,29 @@
303303
{
304304
// API/broker maintenance lane. Review execution jobs are ignored unless the self-host Redis-backed
305305
// runtime binding exists; the deployed Cloudflare worker does not bind it.
306+
//
307+
// #4892: these four values are Cloudflare Queues CONSUMER-BINDING attributes -- read by Cloudflare's
308+
// control plane at `wrangler deploy` time, before any Worker code runs, so unlike a docker-compose
309+
// port mapping or a wrangler.jsonc `vars` entry they CANNOT be made runtime-env-configurable; the
310+
// Worker has no way to read or override them via `env.SOMETHING`. Re-tuning them means editing these
311+
// literals directly (a normal PR), or, once a second deploy target exists, adding that target's own
312+
// named-environment `queues.consumers` override block -- there is only one deploy target today.
313+
//
314+
// The governing constraint, sized against a single installation's GitHub REST rate limit (5000 req/hr
315+
// for a GitHub App installation token, shared across every job this lane processes for that install):
316+
// max_batch_size × max_concurrency = the most jobs that can be in flight, each making GitHub calls,
317+
// at any one instant -- keep that product comfortably under the install's remaining rate-limit
318+
// headroom (github-client.ts already backs off on 403/secondary-rate-limit responses; this bound
319+
// exists to make hitting that backoff path the rare case, not the norm).
306320
// - max_batch_size 5 (was 10): one batch can't bundle as many heavy sweep/backfill jobs at once.
307-
// - max_concurrency 3: bounded fan-out — enough to drain metagraphed's worst sweep within the 2-min
308-
// cron interval, but not so wide it floods the shared GitHub installation rate bucket. (A follow-up
309-
// may tighten this to 2 once the sweep fans into tiny per-PR jobs.)
321+
// - max_concurrency 3: bounded fan-out -- first sized to drain one heavy installation's worst sweep
322+
// within the 2-min cron interval without flooding its own rate bucket (#1283); the SAME bound
323+
// coincidentally also caps fan-out PER installation under today's single-tenant deployment, since
324+
// every job in this lane shares one GitHub App's rate-limit pool regardless of which repo/install
325+
// it's for. A genuinely multi-tenant volume model needs real production job-volume data (job
326+
// rate, distinct-installation count, GitHub rate-limit headroom actually observed) to re-derive
327+
// against -- not available from this worktree; re-tune from a live dashboard/audit_events query,
328+
// not by guessing a bigger number.
310329
// - retry_delay 30: a failed job backs off 30s instead of re-delivering immediately and re-hammering
311330
// the already-overloaded path.
312331
"queue": "loopover-jobs",

0 commit comments

Comments
 (0)