fix(cloudflare/workers): cut Worker read API fan-out that trips 429/971 - #932
fix(cloudflare/workers): cut Worker read API fan-out that trips 429/971#932john-royal wants to merge 1 commit into
Conversation
Memoize account subdomain lookups, skip unmanaged domain/route/cron observation, and serialize the remaining Worker read calls so plain workers.dev Workers stop stampeding Cloudflare on every plan/deploy. Closes #926 Co-authored-by: Cursor <cursoragent@cursor.com>
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/96225a2@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/96225a2@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/96225a2 |
|
Thanks for turning this around so quickly. Before this lands I want to correct the root cause I gave you in #926, because I got it wrong and this PR inherits the error. The account-subdomain lookup was the symptom, not the causeI filed #926 pointing at The dominant cost is Routes are zone-scoped with no account-level enumeration API, so every Worker So the memoization and The consequence for this PR
The fix is already in the file. const zoneIds = Array.from(new Set([
...desired.map((route) => route.zoneId),
...previous.map((route) => route.zoneId),
]));
const liveAll = yield* listWorkerRoutesInZones(scriptName, zoneIds);
Discovering routes attached entirely out of band in a zone Alchemy has never touched is the only thing lost, and that is an adoption concern that probably shouldn't cost a full account sweep on every read anyway. Second point: the domain gating re-opens #942Separately I hit #942 — an omitted const reconcileCustomDomains =
news.domain !== undefined || previousCustomDomains.length > 0;The second disjunct re-arms it. If On my own workaroundThe downstream patch I described in #926 had the same misattribution, and one part of it is worse than what you have written here: I gated the domain read on Evidence qualityTo be clear about what this is: static analysis of the beta.64 provider plus the account inventory I posted in #926. I do not have captured request-count telemetry from the original failure, so I am not claiming an exact number for the run that broke. You asked earlier for a preferred test shape — if it would help, I will put together a reproduction that stubs the Cloudflare operations and asserts request counts for (a) a plain |
Cut Cloudflare Worker read/reconcile API fan-out that was tripping account-level
429/ code971on repeatedplan/deployfor plainworkers.devWorkers (#926).GET /accounts/{id}/workers/subdomainfor the provider lifetime viacachedFunctionCLOUDFLARE_WORKERS_SUBDOMAINto bypass that lookup when the account subdomain is already knownlistDomains, account-wide route discovery, andgetScriptSchedulewhen those surfaces are unmanaged (empty-array props still observe so deletions/drift converge)readEffect.allconcurrency to1