MCPcopy Index your code
hub / github.com/codeaashu/claude-code / drainFlushGate

Function drainFlushGate

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

Source from the content-addressed store, hash-verified

605
606 // ── 8. History flush + drain helpers ────────────────────────────────────
607 function drainFlushGate(): void {
608 const msgs = flushGate.end()
609 if (msgs.length === 0) return
610 for (const msg of msgs) recentPostedUUIDs.add(msg.uuid)
611 const events = toSDKMessages(msgs).map(m => ({
612 ...m,
613 session_id: sessionId,
614 }))
615 if (msgs.some(m => m.type === 'user')) {
616 transport.reportState('running')
617 }
618 logForDebugging(
619 `[remote-bridge] Drained ${msgs.length} queued message(s) after flush`,
620 )
621 void transport.writeBatch(events)
622 }
623
624 async function flushHistory(msgs: Message[]): Promise<void> {
625 // v2 always creates a fresh server session (unconditional createCodeSession

Callers 2

wireTransportCallbacksFunction · 0.70
rebuildTransportFunction · 0.70

Calls 6

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

Tested by

no test coverage detected