MCPcopy Create free account
hub / github.com/anomalyco/opencode / flush

Function flush

packages/app/src/context/server-sdk.tsx:113–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111 let last = 0
112
113 const flush = () => {
114 if (timer) clearTimeout(timer)
115 timer = undefined
116
117 if (queue.length === 0) return
118
119 const events = queue
120 queue = buffer
121 buffer = events
122 queue.length = 0
123
124 last = Date.now()
125 const output = coalesceServerEvents(events)
126 batch(() => {
127 output.forEach((event) => emitter.emit(event.directory, event.payload))
128 })
129
130 buffer.length = 0
131 }
132
133 const schedule = () => {
134 if (timer) return

Callers 2

startFunction · 0.70

Calls 3

coalesceServerEventsFunction · 0.85
batchFunction · 0.85
emitMethod · 0.45

Tested by

no test coverage detected