fixed #2214 - each individual thread will create its own logrotate write handler, because if one is closed, everything crashes in a cascade effect because we're calling .write() after .end(), bleh.

v1.18.x
Julian Lam 11 years ago
parent ee289c3226
commit b7ba6a0d8f

@ -143,14 +143,10 @@ function start() {
plugins.ready(function() {
webserver.init(function() {
// If this callback is called, this means that loader.js is used
process.on('message', function(msg) {
if (msg === 'bind') {
webserver.listen();
}
});
process.send({
action: 'ready'
webserver.listen(function() {
process.send({
action: 'ready'
});
});
});
});

@ -28,6 +28,7 @@ Loader.init = function() {
exec: "app.js",
silent: silent
});
Loader.primaryWorker = 1;
if (silent) {
console.log = function(value) {
@ -56,8 +57,6 @@ Loader.init = function() {
});
}
worker.send('bind');
// Kill an instance in the shutdown queue
var workerToKill = Loader.shutdown_queue.pop();
if (workerToKill) {
@ -162,9 +161,8 @@ Loader.init = function() {
};
Loader.start = function() {
var worker;
Loader.primaryWorker = 1;
var output = logrotate({ file: __dirname + '/logs/output.log', size: '1m', keep: 3, compress: true }),
worker;
for(var x=0;x<numCPUs;x++) {
// Only the first worker sets up templates/sounds/jobs/etc

@ -129,7 +129,7 @@ if(nconf.get('ssl')) {
}
};
module.exports.listen = function() {
module.exports.listen = function(callback) {
var bind_address = ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '0.0.0.0' : nconf.get('bind_address')) + ':' + port;
winston.info('NodeBB attempting to listen on: ' + bind_address);
@ -142,6 +142,10 @@ if(nconf.get('ssl')) {
primary: process.env.handle_jobs === 'true'
});
}
if (typeof callback === 'function') {
callback();
}
});
};

Loading…
Cancel
Save