MCPcopy
hub / github.com/claude-code-best/claude-code / drainFlushGate

Function drainFlushGate

src/bridge/remoteBridgeCore.ts:634–649  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

632
633 // ── 8. History flush + drain helpers ────────────────────────────────────
634 function drainFlushGate(): void {
635 const msgs = flushGate.end()
636 if (msgs.length === 0) return
637 for (const msg of msgs) recentPostedUUIDs.add(msg.uuid)
638 const events: TransportMessage[] = toSDKMessages(msgs).map(m => ({
639 ...m,
640 session_id: sessionId,
641 })) as TransportMessage[]
642 if (shouldReportRunningForMessages(msgs)) {
643 transport.reportState('running')
644 }
645 logForDebugging(
646 `[remote-bridge] Drained ${msgs.length} queued message(s) after flush`,
647 )
648 void transport.writeBatch(events as StdoutMessage[])
649 }
650
651 async function flushHistory(msgs: Message[]): Promise<void> {
652 // v2 always creates a fresh server session (unconditional createCodeSession

Callers 2

wireTransportCallbacksFunction · 0.70
rebuildTransportFunction · 0.70

Calls 7

toSDKMessagesFunction · 0.85
reportStateMethod · 0.80
writeBatchMethod · 0.80
logForDebuggingFunction · 0.50
endMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected