Skip to content

Commit a2b24c0

Browse files
egeominotticlaude
andcommitted
fix: clean up rate limiter on WebSocket disconnect (memory leak)
WebSocket close handler was missing getRateLimiter().removeClient(clientId), causing rate limiter entries to accumulate per-client and never get freed. TCP already did this correctly; now WebSocket matches. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8981e4e commit a2b24c0

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

docs/src/content/docs/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ head:
1010

1111
All notable changes to bunqueue are documented here.
1212

13+
## [2.6.101] - 2026-04-02
14+
15+
### Fixed
16+
- **WebSocket rate limiter leak** — WebSocket disconnect handler was not calling `removeClient()` on the rate limiter, causing per-client rate limiter state to accumulate indefinitely. TCP already did this correctly; now WebSocket matches.
17+
1318
## [2.6.100] - 2026-04-02
1419

1520
### Fixed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bunqueue",
3-
"version": "2.6.100",
3+
"version": "2.6.101",
44
"description": "High-performance job queue for Bun & AI agents. SQLite persistence, cron scheduling, priorities, retries, DLQ, webhooks, native MCP server. Zero external dependencies.",
55
"type": "module",
66
"main": "dist/main.js",

src/infrastructure/server/http.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ export function createHttpServer(queueManager: QueueManager, config: HttpServerC
215215
close(ws: ServerWebSocket<WsData>) {
216216
const clientId = ws.data.id;
217217
wsHandler.onClose(ws);
218+
getRateLimiter().removeClient(clientId);
218219
queueManager.unregisterWorkersByClientId(clientId);
219220
queueManager
220221
.releaseClientJobs(clientId)

0 commit comments

Comments
 (0)