fix bare server not being closed
this will just hang if it isn't closed...
This commit is contained in:
parent
e78d8b3070
commit
f55b5f7635
1 changed files with 5 additions and 7 deletions
12
src/index.js
12
src/index.js
|
|
@ -59,15 +59,13 @@ server.on("listening", () => {
|
|||
});
|
||||
|
||||
// https://expressjs.com/en/advanced/healthcheck-graceful-shutdown.html
|
||||
process.on("SIGINT", shutdown)
|
||||
process.on("SIGTERM", shutdown)
|
||||
process.on("SIGINT", shutdown);
|
||||
process.on("SIGTERM", shutdown);
|
||||
|
||||
function shutdown() {
|
||||
console.log('SIGTERM signal received: closing HTTP server')
|
||||
server.close(() => {
|
||||
console.log('Server closed.');
|
||||
process.exit(0);
|
||||
});
|
||||
console.log("SIGTERM signal received: closing HTTP server");
|
||||
server.close();
|
||||
bare.close();
|
||||
}
|
||||
|
||||
server.listen({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue