fix: wait for pending requests before aborting transports on close #1692
+48
−1
Claude / Claude Code Review
completed
Mar 27, 2026 in 5m 5s
Code review found 1 potential issue
Found 6 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | packages/client/src/client/sse.ts:243-249 |
Graceful close timeout timer is never cleared |
Annotations
Check warning on line 249 in packages/client/src/client/sse.ts
claude / Claude Code Review
Graceful close timeout timer is never cleared
Nit: The `setTimeout` fallback in `Promise.race` within `close()` is never cleared when `Promise.allSettled` resolves first. In Node.js, an active timer keeps the event loop alive, so the process cannot exit for up to 2 seconds after `close()` completes — this will cause test runners (Jest/Vitest) to report open handles. Fix by storing the timer ID and calling `clearTimeout` after the race, or by using `setTimeout(...).unref()`. Same issue exists in `streamableHttp.ts` line 462.
Loading