MCPcopy
hub / github.com/garrytan/gstack / gracefulShutdown

Function gracefulShutdown

design/src/daemon.ts:194–207  ·  view source on GitHub ↗
(exitCode = 0)

Source from the content-addressed store, hash-verified

192// ─── Shutdown ─────────────────────────────────────────────────────
193
194async function gracefulShutdown(exitCode = 0): Promise<void> {
195 if (shuttingDown) return;
196 shuttingDown = true;
197 dlog(`shutting down boards=${boards.size} code=${exitCode}`);
198 if (idleInterval) clearInterval(idleInterval);
199 try {
200 serverRef?.stop();
201 } catch {
202 // already stopped
203 }
204 removeStateFile();
205 if (daemonLog) daemonLog.end();
206 setTimeout(() => process.exit(exitCode), 50);
207}
208
209export function idleCheckTick(): void {
210 if (shuttingDown) return;

Callers 3

idleCheckTickFunction · 0.85
fetchHandlerFunction · 0.85
startFunction · 0.85

Calls 4

removeStateFileFunction · 0.90
dlogFunction · 0.85
stopMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected