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

Method flushStreamEventBuffer

src/cli/transports/ccrClient.ts:771–786  ·  view source on GitHub ↗

* Drain the stream_event delay buffer: accumulate text_deltas into * full-so-far snapshots, clear the timer, enqueue the resulting events. * Called from the timer, from writeEvent on a non-stream message, and from * flush(). close() drops the buffer — call flush() first if you need * del

()

Source from the content-addressed store, hash-verified

769 * delivery.
770 */
771 private async flushStreamEventBuffer(): Promise<void> {
772 if (this.streamEventTimer) {
773 clearTimeout(this.streamEventTimer)
774 this.streamEventTimer = null
775 }
776 if (this.streamEventBuffer.length === 0) return
777 const buffered = this.streamEventBuffer
778 this.streamEventBuffer = []
779 const payloads = accumulateStreamEvents(
780 buffered,
781 this.streamTextAccumulator,
782 )
783 await this.eventUploader.enqueue(
784 payloads.map(payload => ({ payload, ephemeral: true })),
785 )
786 }
787
788 /**
789 * Write an internal worker event via POST /sessions/{id}/worker/internal-events.

Callers 2

writeEventMethod · 0.95
flushMethod · 0.95

Calls 2

accumulateStreamEventsFunction · 0.85
enqueueMethod · 0.45

Tested by

no test coverage detected