MCPcopy Index your code
hub / github.com/simstudioai/sim / flushPending

Function flushPending

apps/sim/lib/execution/event-buffer.ts:877–901  ·  view source on GitHub ↗
(
    scheduleOnFailure = true,
    terminalStatus?: TerminalExecutionStreamStatus
  )

Source from the content-addressed store, hash-verified

875 }
876
877 const flushPending = async (
878 scheduleOnFailure = true,
879 terminalStatus?: TerminalExecutionStreamStatus
880 ): Promise<boolean> => {
881 while (true) {
882 if (flushPromise) {
883 const ok = await flushPromise
884 if (!ok) return false
885 continue
886 }
887 if (pending.length === 0) return true
888
889 flushPromise = doFlush(terminalStatus)
890 let ok = false
891 try {
892 ok = await flushPromise
893 } finally {
894 flushPromise = null
895 }
896 if (!ok) {
897 if (scheduleOnFailure && pending.length > 0) scheduleFlush(getFlushDelayMs())
898 return false
899 }
900 }
901 }
902
903 const writeCore = async (event: ExecutionEvent): Promise<ExecutionEventEntry> => {
904 if (nextEventId === 0 || nextEventId > maxReservedId) {

Callers 6

scheduleFlushFunction · 0.85
writeCoreFunction · 0.85
writeTerminalFunction · 0.85
flushCoreFunction · 0.85
code.tsxFile · 0.85
useCodeUndoRedoFunction · 0.85

Calls 3

doFlushFunction · 0.85
getFlushDelayMsFunction · 0.85
scheduleFlushFunction · 0.70

Tested by

no test coverage detected