fix: address Copilot review round 6 on #2318

RemoteClientTransport tracks open streams only when onFetchStreamUpdate
is registered — the bookkeeping serves that callback alone, and without
it the set would grow by one entry per reconnect.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APKSYHGxXBUpnR7ErFiLJn
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-14 00:03:34 -04:00
commit 091db9b6dd

View file

@ -556,8 +556,11 @@ export class RemoteClientTransport implements Transport {
const entry = parsed.data;
// Stream bookkeeping runs whether or not the consumer logs
// requests: `onFetchStreamUpdate` is documented to work on its
// own, and `close()` needs to know which streams are open.
// own, and `close()` needs to know which streams are open. It
// exists only to serve that callback, though — without one the
// set would only ever grow, one entry per reconnect.
if (
this.options.onFetchStreamUpdate &&
isLongLivedStreamResponse(
entry.method,
findHeader(entry.responseHeaders, "content-type"),