MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / gracefulStopAndExit

Method gracefulStopAndExit

src/runtime/lifecycle.ts:72–90  ·  view source on GitHub ↗
(reason: StopReason)

Source from the content-addressed store, hash-verified

70 }
71
72 private async gracefulStopAndExit(reason: StopReason): Promise<void> {
73 try {
74 await Promise.race([
75 this.gracefulStop(),
76 new Promise<void>((resolve) => {
77 setTimeout(() => {
78 console.warn("[Lifecycle] Graceful stop timed out, forcing exit.");
79 resolve();
80 }, STOP_TIMEOUT_MS);
81 }),
82 ]);
83 } catch (err) {
84 console.error("[Lifecycle] Error during graceful stop:", err);
85 }
86
87 const exitCode =
88 reason === "restart" ? RESTART_EXIT_CODE : SHUTDOWN_EXIT_CODE;
89 this.exitFn(exitCode);
90 }
91
92 private async gracefulStop(): Promise<void> {
93 for (const adapter of [...this.adapters].reverse()) {

Callers 1

requestStopMethod · 0.95

Calls 1

gracefulStopMethod · 0.95

Tested by

no test coverage detected