Skip to content

Commit 9207500

Browse files
committed
fix: end on SIGTERM or SIGINT
1 parent 5eb2ffb commit 9207500

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

server/index.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,17 @@ async function startServer() {
172172
await new Promise<void>((resolve) => httpServer.listen(port, resolve));
173173

174174
async function closeServer() {
175-
logger.crit("Stopping Server");
176-
tryQuietly(frontend.close);
177-
tryQuietly(connectorSubscription.unsubscribe);
178-
tryQuietly(agentSubscription.unsubscribe);
179-
tryQuietly(loggingLevelSubscription.unsubscribe);
180-
tryQuietly(api.stop);
181-
tryQuietly(() => httpServer.close(() => logger.info("HTTP Server Closed")));
182-
logger.crit("Server Stopped");
175+
logger.info("Stopping Server");
176+
await tryQuietly(frontend.close);
177+
await tryQuietly(connectorSubscription.unsubscribe);
178+
await tryQuietly(agentSubscription.unsubscribe);
179+
await tryQuietly(loggingLevelSubscription.unsubscribe);
180+
await tryQuietly(api.stop);
181+
await tryQuietly(() =>
182+
httpServer.close(() => logger.info("HTTP Server Closed"))
183+
);
184+
logger.info("Server Stopped");
185+
process.exit(0);
183186
}
184187

185188
process.on("SIGTERM", closeServer);

0 commit comments

Comments
 (0)