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

Function writeCore

apps/sim/lib/execution/event-buffer.ts:903–921  ·  view source on GitHub ↗
(event: ExecutionEvent)

Source from the content-addressed store, hash-verified

901 }
902
903 const writeCore = async (event: ExecutionEvent): Promise<ExecutionEventEntry> => {
904 if (nextEventId === 0 || nextEventId > maxReservedId) {
905 await reserveIds(1)
906 }
907 const eventId = nextEventId++
908 const compactEvent = await compactEventForBuffer(event, {
909 ...context,
910 executionId,
911 requireDurablePayloads: true,
912 })
913 const entry: ExecutionEventEntry = { eventId, executionId, event: compactEvent }
914 pending.push(entry)
915 if (pending.length >= FLUSH_MAX_BATCH) {
916 await flushPending()
917 } else {
918 scheduleFlush()
919 }
920 return entry
921 }
922
923 const write = (event: ExecutionEvent): Promise<ExecutionEventEntry> => {
924 if (closed) return Promise.resolve({ eventId: 0, executionId, event })

Callers 1

writeFunction · 0.85

Calls 5

reserveIdsFunction · 0.85
compactEventForBufferFunction · 0.85
flushPendingFunction · 0.85
scheduleFlushFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected