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() { plugins.ready(function() {
webserver.init(function() { webserver.init(function() {
// If this callback is called, this means that loader.js is used webserver.listen(function() {
process.on('message', function(msg) { process.send({
if (msg === 'bind') { action: 'ready'
webserver.listen(); });
}
});
process.send({
action: 'ready'
}); });
}); });
}); });

@ -28,6 +28,7 @@ Loader.init = function() {
exec: "app.js", exec: "app.js",
silent: silent silent: silent
}); });
Loader.primaryWorker = 1;
if (silent) { if (silent) {
console.log = function(value) { console.log = function(value) {
@ -56,8 +57,6 @@ Loader.init = function() {
}); });
} }
worker.send('bind');
// Kill an instance in the shutdown queue // Kill an instance in the shutdown queue
var workerToKill = Loader.shutdown_queue.pop(); var workerToKill = Loader.shutdown_queue.pop();
if (workerToKill) { if (workerToKill) {
@ -162,9 +161,8 @@ Loader.init = function() {
}; };
Loader.start = function() { Loader.start = function() {
var worker; var output = logrotate({ file: __dirname + '/logs/output.log', size: '1m', keep: 3, compress: true }),
worker;
Loader.primaryWorker = 1;
for(var x=0;x<numCPUs;x++) { for(var x=0;x<numCPUs;x++) {
// Only the first worker sets up templates/sounds/jobs/etc // 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; 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); winston.info('NodeBB attempting to listen on: ' + bind_address);
@ -142,6 +142,10 @@ if(nconf.get('ssl')) {
primary: process.env.handle_jobs === 'true' primary: process.env.handle_jobs === 'true'
}); });
} }
if (typeof callback === 'function') {
callback();
}
}); });
}; };

Loading…
Cancel
Save