[miniflare] Key local rate limit counters by namespace_id#14572
Conversation
Local rate-limit counters were keyed by binding name. That meant two bindings referencing the same namespace didn't share a limit, and ratelimits had to be stripped from secondary workers in multiworker dev (they caused a crash). Key the entry service and Durable Object instance by namespace_id instead, deduping bindings that share a namespace so they share one counter. The wrangler bridge defaults namespace_id to the binding name so freeform unsafe_ratelimit bindings keep per-binding isolation, and multiworker ratelimits are re-enabled.
🦋 Changeset detectedLatest commit: b4da4fd The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
|
✅ All changesets look good |
@cloudflare/autoconfig
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
|
The However, this is a judgment call: the My review is complete. The change is well-designed, correct, and thoroughly tested:
The one arguable point is that LGTM |
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
This PR extends one that we just landed - #14409
Local rate limit counters in
wrangler devand Miniflare were keyed by binding name. That meant two bindings referencing the samenamespace_idwere treated as separate limiters (unlike production), and rate limit bindings had to be stripped from secondary Workers in multiworkerwrangler devsessions because they caused a startup crash.This keys the entry service and backing Durable Object instance by
namespace_idinstead, deduping bindings that share a namespace so they share a single counter. The wrangler → Miniflare bridge defaultsnamespace_idto the binding name, so freeformunsaferate limit bindings keep per-binding isolation. Multiworker rate limit bindings are re-enabled.wrangler dev/ Miniflare rate limiting with existing production behavior — there is no public API or configuration surface change to document.