(exitCode = 0)
| 192 | // ─── Shutdown ───────────────────────────────────────────────────── |
| 193 | |
| 194 | async 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 | |
| 209 | export function idleCheckTick(): void { |
| 210 | if (shuttingDown) return; |
no test coverage detected