滑动窗口版的限流写好了:按「上一窗口计数 × 剩余比例 + 当前窗口计数」估算请求数,窗口边界不再出现突刺。计数存储做成了可替换的接口,内置内存和 Workers KV 两种实现。
The sliding-window limiter is in: it estimates requests as “previous window × the share left + this window”, so there is no burst at the window’s edge any more. The counter store is an interface, with a memory one and a Workers KV one built in.
测试结果Tests
- 新增 9 个用例,覆盖窗口边界、并发请求和存储失效,全部通过(9 new cases, for the window’s edge, concurrent requests and a failing store, all passing (
bun test src/middleware/rate-limiter)。).
- 响应头换成 IETF 草案的 Headers now the IETF draft’s
RateLimit 和 and RateLimit-Policy,旧头保留一个版本。; the old ones kept for a release.
迁移说明写在 How to migrate is in MIGRATION.md。.
16s 190 tok/s$0.0458.2k tokens
把 Deno 和 Node 的回归也跑一下,结果汇总给我Run the Deno and Node regressions too, and sum them up for me
读了 3 个文件,运行了 2 条命令Read 3 files, ran 2 commands· 53s
启动了 2 个后台智能体Started 2 background agents
✻ 等 Deno 和 Node 两边跑完…Waiting on the Deno and Node runs…
Deno 2 回归测试Deno 2 regression run· bun x deno test运行中 · 41sRunning · 41s
Node 22 回归测试Node 22 regression run· node --test运行中 · 38sRunning · 38s
3 个文件已更改3 files changed+86−24全部撤销Undo all全部保留Keep all
规划、搜索、构建任何内容 · 拖入或粘贴文件 · / 命令Plan, search, build anything · drop or paste files · / for commands
∞Agent
完全访问Full access
Opus 5.5