Skip to content

Commit 0b1898b

Browse files
refactor: simplify stream ID handling in replayEvents
Always use replayedStreamId from replayEventsAfter instead of preferring streamId from getStreamIdForEventId. Both should return the same value for a correctly implemented event store, and replayEventsAfter is the authoritative source since it's the required method.
1 parent f08a3e8 commit 0b1898b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/server/streamableHttp.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,13 +435,11 @@ export class StreamableHTTPServerTransport implements Transport {
435435
}
436436
});
437437

438-
// Use streamId from getStreamIdForEventId if available, otherwise from replay
439-
const finalStreamId = streamId ?? replayedStreamId;
440-
this._streamMapping.set(finalStreamId, res);
438+
this._streamMapping.set(replayedStreamId, res);
441439

442440
// Set up close handler for client disconnects
443441
res.on('close', () => {
444-
this._streamMapping.delete(finalStreamId);
442+
this._streamMapping.delete(replayedStreamId);
445443
});
446444

447445
// Add error handler for replay stream

0 commit comments

Comments
 (0)