MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / flushDeferred

Function flushDeferred

source code/utils/bufferedWriter.ts:62–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60 // short. Timer-based flushes already run outside user code paths so they
61 // stay synchronous.
62 function flushDeferred(): void {
63 if (pendingOverflow) {
64 // A previous overflow write is still queued. Coalesce into it to
65 // preserve ordering — writes land in a single setImmediate-ordered batch.
66 pendingOverflow.push(...buffer)
67 buffer = []
68 bufferBytes = 0
69 clearTimer()
70 return
71 }
72 const detached = buffer
73 buffer = []
74 bufferBytes = 0
75 clearTimer()
76 pendingOverflow = detached
77 setImmediate(() => {
78 const toWrite = pendingOverflow
79 pendingOverflow = null
80 if (toWrite) writeFn(toWrite.join(''))
81 })
82 }
83
84 return {
85 write(content: string): void {

Callers 1

writeFunction · 0.85

Calls 2

writeFnFunction · 0.85
clearTimerFunction · 0.70

Tested by

no test coverage detected