Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions core/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,20 @@ async function main() {
logger.info(`Lock file created at ${lockFile.lockPath}`);

// Graceful shutdown
const shutdown = async () => {
let shuttingDown = false;
const shutdown = () => {
if (shuttingDown) return;
shuttingDown = true;

logger.info('Shutting down gracefully...');
server.close();
await lockFile.remove();
process.exit(0);
void lockFile.remove()
.catch((error) => {
logger.warn('Failed to remove lock file during shutdown:', error);
})
.finally(() => {
process.exit(0);
});
};

process.on('SIGTERM', shutdown);
Expand Down
Loading