fixed problem with nodebb always restarting when SIGTERM'd -- @frissdiegurke

v1.18.x
Julian Lam 11 years ago
parent ef342b9d40
commit 7aa785b205

@ -143,9 +143,12 @@ function start() {
process.on('SIGTERM', shutdown); process.on('SIGTERM', shutdown);
process.on('SIGINT', shutdown); process.on('SIGINT', shutdown);
process.on('SIGHUP', restart); process.on('SIGHUP', restart);
process.on('uncaughtException', function() { process.on('uncaughtException', function(err) {
winston.error(err.message);
console.log(err.stack);
meta.js.killMinifier(); meta.js.killMinifier();
shutdown(); shutdown(1);
}) })
} else { } else {
winston.warn('Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec:'); winston.warn('Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec:');
@ -286,7 +289,7 @@ function shutdown(code) {
winston.info('[app] Database connection closed.'); winston.info('[app] Database connection closed.');
winston.info('[app] Shutdown complete.'); winston.info('[app] Shutdown complete.');
process.exit(1); process.exit(code || 0);
} }
function restart() { function restart() {
@ -297,7 +300,7 @@ function restart() {
}); });
} else { } else {
winston.error('[app] Could not restart server. Shutting down.'); winston.error('[app] Could not restart server. Shutting down.');
shutdown(); shutdown(1);
} }
} }

Loading…
Cancel
Save