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

Method requestStop

src/runtime/lifecycle.ts:47–70  ·  view source on GitHub ↗
(
    reason: StopReason,
    trigger: LifecycleTrigger,
  )

Source from the content-addressed store, hash-verified

45 }
46
47 private async requestStop(
48 reason: StopReason,
49 trigger: LifecycleTrigger,
50 ): Promise<CommandResult> {
51 if (this.stopReason) {
52 const message =
53 this.stopReason === "restart"
54 ? "Restart already in progress."
55 : "Shutdown already in progress.";
56 return { success: true, message };
57 }
58
59 this.stopReason = reason;
60 console.log(`[Lifecycle] ${reason} requested via ${trigger}`);
61
62 setTimeout(() => {
63 void this.gracefulStopAndExit(reason);
64 }, 50);
65
66 return {
67 success: true,
68 message: reason === "restart" ? "Restarting..." : "Shutting down...",
69 };
70 }
71
72 private async gracefulStopAndExit(reason: StopReason): Promise<void> {
73 try {

Callers 2

requestRestartMethod · 0.95
requestShutdownMethod · 0.95

Calls 1

gracefulStopAndExitMethod · 0.95

Tested by

no test coverage detected