From 8c7dfdcef2cb8dc8cde6f8108fa32a384ea8003f Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 9 Sep 2015 16:57:41 -0700 Subject: [PATCH] Wait upto 3 seconds for the app to quit Otherwise systemd will kill us and we get crash emails. Fixes #483 --- app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index b677d3f29..191d55bad 100755 --- a/app.js +++ b/app.js @@ -43,5 +43,13 @@ server.start(function (err) { var NOOP_CALLBACK = function () { }; -process.on('SIGINT', function () { server.stop(NOOP_CALLBACK); }); -process.on('SIGTERM', function () { server.stop(NOOP_CALLBACK); }); +process.on('SIGINT', function () { + server.stop(NOOP_CALLBACK); + setTimeout(process.exit.bind(process), 3000); +}); + +process.on('SIGTERM', function () { + server.stop(NOOP_CALLBACK); + setTimeout(process.exit.bind(process), 3000); +}); +