Skip to content

Commit 8bd3c69

Browse files
committed
Reconnect input stream tail after SSE timeout
1 parent b6c1fc1 commit 8bd3c69

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/core/src/v3/inputStreams/manager.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,15 @@ export class StandardInputStreamManager implements InputStreamManager {
195195
})
196196
.finally(() => {
197197
this.tails.delete(streamId);
198+
199+
// Auto-reconnect if there are still active handlers or waiters
200+
const hasHandlers =
201+
this.handlers.has(streamId) && this.handlers.get(streamId)!.size > 0;
202+
const hasWaiters =
203+
this.onceWaiters.has(streamId) && this.onceWaiters.get(streamId)!.length > 0;
204+
if (hasHandlers || hasWaiters) {
205+
this.#ensureStreamTailConnected(streamId);
206+
}
198207
});
199208
this.tails.set(streamId, { abortController, promise });
200209
}

0 commit comments

Comments
 (0)