mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
fixed #1395
This commit is contained in:
9
app.js
9
app.js
@@ -122,7 +122,8 @@ function start() {
|
||||
webserver = require('./src/webserver'),
|
||||
sockets = require('./src/socket.io'),
|
||||
plugins = require('./src/plugins'),
|
||||
upgrade = require('./src/upgrade');
|
||||
upgrade = require('./src/upgrade')
|
||||
meta = require('./src/meta');
|
||||
|
||||
templates.setGlobal('relative_path', nconf.get('relative_path'));
|
||||
|
||||
@@ -142,6 +143,10 @@ function start() {
|
||||
process.on('SIGTERM', shutdown);
|
||||
process.on('SIGINT', shutdown);
|
||||
process.on('SIGHUP', restart);
|
||||
process.on('uncaughtException', function() {
|
||||
meta.js.killMinifier();
|
||||
shutdown();
|
||||
})
|
||||
} else {
|
||||
winston.warn('Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec:');
|
||||
winston.warn(' node app --upgrade');
|
||||
@@ -281,7 +286,7 @@ function shutdown(code) {
|
||||
winston.info('[app] Database connection closed.');
|
||||
|
||||
winston.info('[app] Shutdown complete.');
|
||||
process.exit();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function restart() {
|
||||
|
||||
@@ -8,8 +8,7 @@ var nconf = require('nconf'),
|
||||
nbb_start = function() {
|
||||
if (timesStarted > 3) {
|
||||
console.log('\n[loader] Experienced three start attempts in 10 seconds, most likely am error on startup. Halting.');
|
||||
process.exit();
|
||||
return;
|
||||
return nbb_stop();
|
||||
}
|
||||
|
||||
timesStarted++;
|
||||
@@ -54,7 +53,7 @@ var nconf = require('nconf'),
|
||||
}
|
||||
},
|
||||
nbb_restart = function() {
|
||||
nbb.on('exit', function() {
|
||||
nbb.removeAllListeners('exit').on('exit', function() {
|
||||
nbb_start();
|
||||
});
|
||||
nbb.kill();
|
||||
|
||||
@@ -296,7 +296,7 @@ var fs = require('fs'),
|
||||
},
|
||||
minify: function(minify) {
|
||||
// Prepare js for minification/concatenation
|
||||
var minifier = fork('minifier.js');
|
||||
var minifier = this.minifierProc = fork('minifier.js');
|
||||
|
||||
minifier.on('message', function(payload) {
|
||||
if (payload.action !== 'error') {
|
||||
@@ -317,6 +317,11 @@ var fs = require('fs'),
|
||||
scripts: Meta.js.scripts
|
||||
});
|
||||
});
|
||||
},
|
||||
killMinifier: function(callback) {
|
||||
if (this.minifierProc) {
|
||||
this.minifierProc.kill('SIGTERM');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user