限流改成滑动窗口Sliding-window rate limiting Fast IDE
新对话New chat
智能体Agents按项目By project ⌄
已置顶Pinned2
🔥 hono
限流改成滑动窗口Sliding-window rate limiting+86now
JSX 流式渲染在 Bun 上更慢JSX streaming slower on Bun2m
读取 body 之后 c.header 丢失c.header lost after reading body14m
嵌套路由的 RPC 客户端类型RPC client types for nested routes1h
显示更多(23)Show more (23)
⚡ fastapi
依赖覆盖在测试之间串了Dependency overrides leak between tests25m
给 webhooks 加 OpenAPI 示例OpenAPI examples for webhooks7h
✏️ excalidraw
缩放时箭头绑定抖动Arrow bindings jitter on zoom40m
暗色模式下的协作者光标Collaborator cursors in dark mode1d
🦙 ollama12
🔍 ripgrep6
已归档 · 4Archived · 4

滑动窗口版的限流写好了:按「上一窗口计数 × 剩余比例 + 当前窗口计数」估算请求数,窗口边界不再出现突刺。计数存储做成了可替换的接口,内置内存和 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
hono: feat/sliding-window62K / 200K
文件Files
变更Changes 3
终端Terminal
浏览器Browser
main
hono 所有分支All branches 用户User
本地更改(3)Local changes (3)
Merge branch 'feat/jsx-stream'10:10Mmia
feat(jsx): flush small chunks together09:42Mmia
test(router): trie backtracking昨天YesterdayMmia
docs: middleware list昨天YesterdayAalex
fix(router): regexp route cacheOct 30Mmia
perf: fewer header copiesOct 29Aalex
chore: bun 1.2Oct 29Mmia
提交CommitStash树形Tree
honofeat/sliding-window
src/middleware/rate-limiter
index.ts+41−24
index.test.ts+28
store.ts+17
feat(rate-limiter): sliding window, pluggable store
按上一窗口加权估算,窗口边界不再突刺;计数存储可替换。Weighs in the previous window, so no burst at the edge; the store can be swapped.
生成提交信息Write message 提交Commit 提交并推送Commit & Push