Repository navigation
fix(cloudflare/workers): scope Worker read route discovery to known zones - #944
Merged
sam-goodwin merged 1 commit intoJul 27, 2026
Merged
Conversation
sam-goodwin
reviewed
Jul 25, 2026
sam-goodwin
added a commit
that referenced
this pull request
Jul 28, 2026
…g on top) Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Oct 31, 2026
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.
Worker
readdiscovered zone routes by enumerating every zone on the account and then listing routes in each one. Routes are zone-scoped with no account-level enumeration API, so that is O(zones) requests on every read, issued atconcurrency: "unbounded". On an account with a few hundred zones a couple of plan/deploy cycles exhausts Cloudflare's per-user API budget and unrelated calls start coming back429/ code971(#926).reconcileRoutesalready avoids the sweep — it scopes itself to the zones implied bydesired ∪ previous.readnow uses the same bounded zone set.listWorkerRoutesInZonesis also bounded now, since it still fans out one request per zone on the reconcile path.This is complementary to #932 rather than a replacement. That PR gates the sweep on whether Alchemy manages routes for the Worker, which removes the cost for a plain
workers.devWorker; this removes the cost for a Worker that actually declaresroutes, where the gate passes and the account-wide fan-out still runs unchanged.Trade-off
A route attached out of band in a zone this Worker has never had a route in is no longer discovered by
read. That is the blind spotreconcileRoutesalready has, so the two paths are now consistent rather than one of them paying for account-wide discovery on every read.