MCPcopy
hub / github.com/coder/mux / finishReplay

Function finishReplay

src/node/orpc/replayBufferedStreamMessageRelay.ts:159–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157 };
158
159 const finishReplay = () => {
160 // Flush buffered live session messages after replay (`caught-up` already queued by replayHistory).
161 for (const message of bufferedLiveSessionMessages) {
162 if (isReplayBufferedDeltaMessage(message) && shouldDropBufferedDelta(message)) {
163 continue;
164 }
165 if (isReplayBufferedInitMessage(message) && shouldDropBufferedInit(message)) {
166 continue;
167 }
168 push(message);
169 }
170
171 isReplaying = false;
172
173 // Avoid retaining replay keys for the lifetime of the subscription.
174 replayedDeltaKeyCounts.clear();
175 replayedInitKeyCounts.clear();
176 bufferedLiveSessionMessages.length = 0;
177 };
178
179 return { handleSessionMessage, finishReplay };
180}

Callers

nothing calls this directly

Calls 6

shouldDropBufferedDeltaFunction · 0.85
shouldDropBufferedInitFunction · 0.85
pushFunction · 0.70
clearMethod · 0.45

Tested by

no test coverage detected