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

Function finalizeTiming

apps/sim/providers/streaming-execution.ts:177–196  ·  view source on GitHub ↗

* Overwrites the placeholder timing with the drain timestamp. For the simple * path the first time segment is also finalized; for the accumulated path only * the top-level aggregate is touched (segments are pre-finalized by the loop).

(
  output: NormalizedBlockOutput,
  providerStartTime: number,
  kind: StreamingTiming['kind']
)

Source from the content-addressed store, hash-verified

175 * the top-level aggregate is touched (segments are pre-finalized by the loop).
176 */
177function finalizeTiming(
178 output: NormalizedBlockOutput,
179 providerStartTime: number,
180 kind: StreamingTiming['kind']
181): void {
182 const streamEndTime = Date.now()
183 const providerTiming = output.providerTiming
184 if (!providerTiming) return
185
186 providerTiming.endTime = new Date(streamEndTime).toISOString()
187 providerTiming.duration = streamEndTime - providerStartTime
188
189 if (kind === 'simple') {
190 const segment = providerTiming.timeSegments?.[0]
191 if (segment) {
192 segment.endTime = streamEndTime
193 segment.duration = streamEndTime - providerStartTime
194 }
195 }
196}

Callers 14

createStreamingExecutionFunction · 0.85
index.tsFile · 0.85
index.tsFile · 0.85
index.tsFile · 0.85
index.tsFile · 0.85
index.tsFile · 0.85
index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected