Skip to content

Commit d83942e

Browse files
committed
fix(server): clear keepalive timer before reassignment in replayEvents
Prevent timer handle leaks when concurrent reconnect requests bypass the conflict check. This edge case is possible when EventStore omits the optional getStreamIdForEventId method, allowing duplicate replay attempts to start new timers without cleaning up existing ones.
1 parent 6a2fd6f commit d83942e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/server/src/server/streamableHttp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ export class WebStandardStreamableHTTPServerTransport implements Transport {
586586
// Start keepalive timer for the replayed stream so reconnecting
587587
// clients remain protected from proxy idle timeouts
588588
if (this._keepAliveInterval !== undefined) {
589+
this._clearKeepAliveTimer();
589590
this._keepAliveTimer = setInterval(() => {
590591
try {
591592
streamController!.enqueue(encoder.encode(': keepalive\n\n'));

0 commit comments

Comments
 (0)