Skip to content

Commit 9cfa4f4

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 aec92db commit 9cfa4f4

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

packages/server/src/server/streamableHttp.ts

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

0 commit comments

Comments
 (0)