MCPcopy Create free account
hub / github.com/ChinaSiro/claude-code-sourcemap / flushDeferred

Function flushDeferred

restored-src/src/utils/bufferedWriter.ts:60–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

writeFunction · 0.85

Calls 5

setImmediateFunction · 0.85
clearTimerFunction · 0.70
writeFnFunction · 0.70
pushMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected