vibetunnel/web/src/server/services/shutdown-state.ts
Mario Zechner b1718c27fa fix: handle HQ mode shutdown gracefully to prevent e2e test errors
- Add global shutdown state tracking via shutdown-state.ts module
- Update refresh-sessions endpoint to return 503 during shutdown
- Skip HQ notifications in control-dir-watcher during shutdown
- Disable remote health checks during server shutdown
- Suppress expected connection errors when servers are shutting down

This prevents the flood of "Failed to refresh sessions" and "Failed to
notify HQ" errors that were appearing in the HQ e2e test logs when
servers were shutting down.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 23:56:15 +02:00

15 lines
370 B
TypeScript

/**
* Global shutdown state management for the server.
* This module tracks whether the server is currently shutting down
* to allow various components to handle shutdown gracefully.
*/
let shuttingDown = false;
export function isShuttingDown(): boolean {
return shuttingDown;
}
export function setShuttingDown(value: boolean): void {
shuttingDown = value;
}