Admission control for the HTTP edge. Each allow call counts one request against key and
answers whether it may proceed; the limit and window are the adapter's policy, so the server
only ever asks for the verdict. A throwing limiter is treated as absent for that request —
the edge fails open, because a down limiter backend should degrade protection, not
availability.
Example
// A fixed-budget limiter: 100 requests per key, refilled by the adapter's own policy. constbudgets = newMap<string, number>(); constlimiter: RateLimiter = { asyncallow(key) { constleft = budgets.get(key) ?? 100; if (left === 0) return { allowed:false, retryAfterMs:1_000 }; budgets.set(key, left - 1); return { allowed:true }; }, };
Admission control for the HTTP edge. Each
allowcall counts one request againstkeyand answers whether it may proceed; the limit and window are the adapter's policy, so the server only ever asks for the verdict. A throwing limiter is treated as absent for that request — the edge fails open, because a down limiter backend should degrade protection, not availability.Example