Merge pull request #1642 from michaelarnauts/patch-2

Handle SIGTERM messages
This commit is contained in:
Michael Teeuw 2019-04-09 09:53:16 +02:00 committed by GitHub
commit 834ab5c6b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Updated ### Updated
### Fixed ### Fixed
- Handle SIGTERM messages
## [2.7.1] - 2019-04-02 ## [2.7.1] - 2019-04-02

View File

@ -263,6 +263,15 @@ var App = function() {
this.stop(); this.stop();
process.exit(0); process.exit(0);
}); });
/* We also need to listen to SIGTERM signals so we stop everything when we are asked to stop by the OS.
*/
process.on("SIGTERM", () => {
console.log("[SIGTERM] Received. Shutting down server...");
setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds
this.stop();
process.exit(0);
});
}; };
module.exports = new App(); module.exports = new App();