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

Function stop

packages/node/src/backend/nodeBackendInline.ts:604–638  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

602 },
603
604 async stop(): Promise<void> {
605 if (disposed) return;
606 if (fatal !== null) throw fatal;
607 if (!started) return;
608 if (stopDef !== null) {
609 await stopDef.promise;
610 return;
611 }
612
613 stopDef = deferred<void>();
614 stopSettled = false;
615 stopRequested = true;
616 clearPollLoop();
617
618 const stopErr = new Error("NodeBackend(inline): stopped");
619 while (eventWaiters.length > 0) eventWaiters.shift()?.reject(stopErr);
620 eventQueue = [];
621
622 if (engineId !== null && native !== null) {
623 try {
624 native.engineDestroy(engineId);
625 } catch {
626 // best effort on stop
627 }
628 }
629 engineId = null;
630 started = false;
631
632 if (!stopSettled && stopDef !== null) {
633 stopSettled = true;
634 stopDef.resolve();
635 }
636 await stopDef.promise;
637 stopDef = null;
638 },
639
640 dispose(): void {
641 if (disposed) return;

Callers

nothing calls this directly

Calls 3

clearPollLoopFunction · 0.85
resolveMethod · 0.80
deferredFunction · 0.50

Tested by

no test coverage detected