Merge pull request #89 from kevinastone/patch-2
Gracefully shutdown on both SIGINT + SIGTERM
This commit is contained in:
commit
5da8185633
1 changed files with 5 additions and 2 deletions
|
|
@ -99,8 +99,11 @@ const server = app.listen(port, () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// graceful shutdown
|
// graceful shutdown
|
||||||
process.on('SIGINT', () => {
|
const gracefulShutdown = () => {
|
||||||
server.close(() => {
|
server.close(() => {
|
||||||
console.log('Server closed');
|
console.log('Server closed');
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
|
||||||
|
process.on('SIGINT', gracefulShutdown);
|
||||||
|
process.on('SIGTERM', gracefulShutdown);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue