MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / pollLoop

Function pollLoop

packages/core/src/app/createApp/eventLoop.ts:486–512  ·  view source on GitHub ↗
(token: number)

Source from the content-addressed store, hash-verified

484 }
485
486 async function pollLoop(token: number): Promise<void> {
487 while (options.getRuntimeState() === "Running" && token === options.getPollToken()) {
488 let batch: BackendEventBatch;
489 try {
490 batch = await options.backend.pollEvents();
491 } catch (error: unknown) {
492 if (options.getRuntimeState() === "Running" && token === options.getPollToken()) {
493 options.fatalNowOrEnqueue(
494 "ZRUI_BACKEND_ERROR",
495 `pollEvents rejected: ${describeThrown(error)}`,
496 );
497 }
498 return;
499 }
500
501 if (token !== options.getPollToken() || options.getRuntimeState() !== "Running") {
502 try {
503 batch.release();
504 } catch {
505 // ignore
506 }
507 return;
508 }
509
510 options.enqueueWorkItem({ kind: "eventBatch", batch });
511 }
512 }
513
514 return {
515 commitUpdates,

Callers

nothing calls this directly

Calls 2

pollEventsMethod · 0.65
describeThrownFunction · 0.50

Tested by

no test coverage detected