From eb14f9b088ec48b77c3bad612eba4c73cbd22930 Mon Sep 17 00:00:00 2001 From: Moritz Zwerger Date: Sun, 16 Mar 2025 23:11:09 +0100 Subject: [PATCH] graceful shutdown (#10958) * graceful shutdown The main entrypoint now handles the SIGTERM signal and stops the server. * Don't call process.exit on shutdown That is not graceful in nodejs, see https://kostasbariotis.com/why-you-should-not-use-process-exit/ --- server.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server.js b/server.js index 4495db717b..cf85493e4b 100644 --- a/server.js +++ b/server.js @@ -62,4 +62,9 @@ if (fs.existsSync(legacySecretsPath)) { } export const server = new Server(config) +process.on('SIGTERM', async () => { + console.log('SIGTERM received, shutting down...') + await server.stop() +}) + await server.start()