Skip to content

Commit eb14f9b

Browse files
authored
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/
1 parent 834e4e1 commit eb14f9b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server.js

+5
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@ if (fs.existsSync(legacySecretsPath)) {
6262
}
6363
export const server = new Server(config)
6464

65+
process.on('SIGTERM', async () => {
66+
console.log('SIGTERM received, shutting down...')
67+
await server.stop()
68+
})
69+
6570
await server.start()

0 commit comments

Comments
 (0)