removed node cluster spawn procs on ports

This commit is contained in:
barisusakli
2014-12-03 14:03:41 -05:00
parent 3ad3e781f3
commit 64e13df14c
8 changed files with 139 additions and 238 deletions

View File

@@ -9,7 +9,6 @@ var path = require('path'),
server,
winston = require('winston'),
async = require('async'),
cluster = require('cluster'),
emailer = require('./emailer'),
meta = require('./meta'),
@@ -82,11 +81,7 @@ if(nconf.get('ssl')) {
console.log(err.stack);
if (err.code === 'EADDRINUSE') {
winston.error('NodeBB address in use, exiting...');
if (cluster.isWorker) {
cluster.worker.kill();
} else {
process.exit(0);
}
process.exit(0);
} else {
throw err;
}
@@ -103,9 +98,7 @@ if(nconf.get('ssl')) {
logger.init(app);
var bind_address = ((nconf.get('bind_address') === "0.0.0.0" || !nconf.get('bind_address')) ? '0.0.0.0' : nconf.get('bind_address')) + ':' + port;
if (cluster.isWorker) {
port = 0;
}
server.listen(port, nconf.get('bind_address'), function(err) {
if (err) {
winston.info('NodeBB was unable to listen on: ' + bind_address);
@@ -117,7 +110,7 @@ if(nconf.get('ssl')) {
process.send({
action: 'listening',
bind_address: bind_address,
primary: process.env.handle_jobs === 'true'
primary: nconf.get('isPrimary') === 'true'
});
}
@@ -125,13 +118,4 @@ if(nconf.get('ssl')) {
});
};
process.on('message', function(message, connection) {
if (!message || message.action !== 'sticky-session:connection') {
return;
}
process.send({action: 'sticky-session:accept', handleIndex: message.handleIndex});
server.emit('connection', connection);
});
}(WebServer));