fix bare server not being closed

this will just hang if it isn't closed...
This commit is contained in:
David Reed 2023-06-04 17:20:07 -04:00
parent e78d8b3070
commit f55b5f7635
No known key found for this signature in database
GPG key ID: 2211691D8A1EE72F

View file

@ -59,15 +59,13 @@ server.on("listening", () => {
}); });
// https://expressjs.com/en/advanced/healthcheck-graceful-shutdown.html // https://expressjs.com/en/advanced/healthcheck-graceful-shutdown.html
process.on("SIGINT", shutdown) process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown) process.on("SIGTERM", shutdown);
function shutdown() { function shutdown() {
console.log('SIGTERM signal received: closing HTTP server') console.log("SIGTERM signal received: closing HTTP server");
server.close(() => { server.close();
console.log('Server closed.'); bare.close();
process.exit(0);
});
} }
server.listen({ server.listen({