From fd53541719d336f6ab8eaaff82cfefcd89e6277a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Arnauts?= Date: Sat, 6 Apr 2019 20:50:54 +0200 Subject: [PATCH 1/2] Handle SIGTERM messages --- js/app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/app.js b/js/app.js index 95c9693b..da1d24a8 100644 --- a/js/app.js +++ b/js/app.js @@ -263,6 +263,15 @@ var App = function() { this.stop(); 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(); From 17425dcaf7cc8cdefda5ff1e7be960060b5c9760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Arnauts?= Date: Sun, 7 Apr 2019 16:41:05 +0200 Subject: [PATCH 2/2] Add CHANGELOG entry. Fix test. --- CHANGELOG.md | 1 + js/app.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef3d183a..f674787b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Updated ### Fixed +- Handle SIGTERM messages ## [2.7.1] - 2019-04-02 diff --git a/js/app.js b/js/app.js index da1d24a8..4a10ba6d 100644 --- a/js/app.js +++ b/js/app.js @@ -263,7 +263,7 @@ var App = function() { this.stop(); 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", () => {