Skip to content

Node.js based forum software built for the modern web

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

Julian Lam7aa785b2056a
diff --git a/app.js b/app.js
index 9661002f91..f827254c24 100644
--- a/app.js
+++ b/app.js
@@ -143,9 +143,12 @@ function start() {
process.on('SIGTERM', shutdown);
process.on('SIGINT', shutdown);
process.on('SIGHUP', restart);
- process.on('uncaughtException', function() {
+ process.on('uncaughtException', function(err) {
+ winston.error(err.message);
+ console.log(err.stack);
+
meta.js.killMinifier();
- shutdown();
+ shutdown(1);
})
} else {
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] Shutdown complete.');
- process.exit(1);
+ process.exit(code || 0);
}
function restart() {
@@ -297,7 +300,7 @@ function restart() {
});
} else {
winston.error('[app] Could not restart server. Shutting down.');
- shutdown();
+ shutdown(1);
}
}