MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / driveWarmupTicks

Function driveWarmupTicks

packages/engine/src/services/frameCapture.ts:289–312  ·  view source on GitHub ↗
(
  options: WarmupTickOptions,
  state: WarmupTickState,
)

Source from the content-addressed store, hash-verified

287}
288
289export async function driveWarmupTicks(
290 options: WarmupTickOptions,
291 state: WarmupTickState,
292): Promise<void> {
293 const sleep = options.sleep ?? realSleep;
294 while (true) {
295 if (options.lockWarmupTicks) {
296 // Locked mode exits on the iteration count, ignoring `state.running` —
297 // the caller flips `running=false` after page-readiness but we keep
298 // ticking until LOCKED_WARMUP_TICKS so the count is host-independent.
299 if (state.ticks >= LOCKED_WARMUP_TICKS) return;
300 } else {
301 // Unlocked mode is wall-clock-bounded.
302 if (!state.running) return;
303 }
304 try {
305 await options.tick(state.ticks * options.intervalMs, options.intervalMs);
306 state.ticks += 1;
307 } catch {
308 // Page not ready yet; keep spinning.
309 }
310 await sleep(options.intervalMs);
311 }
312}
313
314export function resolveCaptureSessionOptions(
315 options: CaptureOptions,

Callers 3

initializeSessionFunction · 0.85
runWithSimulatedPageLoadFunction · 0.85

Calls 2

sleepFunction · 0.50
tickMethod · 0.45

Tested by 1

runWithSimulatedPageLoadFunction · 0.68