Skip to content

Commit 1de4242

Browse files
authored
Merge pull request #321 from DrMurx/gracefulSigtermHandling
Handle SIGTERM the same way SIGINT is handled
2 parents 1473437 + 20dc312 commit 1de4242

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

app.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,8 @@ process.on('uncaughtException', function (err) {
626626
process.exit(1);
627627
});
628628

629-
// gracefully exit
630-
process.on('SIGINT', function () {
629+
// install exit handler
630+
function handleTermSignals() {
631631
config.maintenance = true;
632632
// disconnect all socket.io clients
633633
Object.keys(io.sockets.sockets).forEach(function (key) {
@@ -649,4 +649,6 @@ process.on('SIGINT', function () {
649649
});
650650
}
651651
}, 100);
652-
});
652+
}
653+
process.on('SIGINT', handleTermSignals);
654+
process.on('SIGTERM', handleTermSignals);

0 commit comments

Comments
 (0)