mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-21 16:00:26 +01:00
better handling of port in use errors with cluster
This commit is contained in:
@@ -108,7 +108,11 @@ if(nconf.get('ssl')) {
|
||||
server.on("error", function(err){
|
||||
if (err.code === 'EADDRINUSE') {
|
||||
winston.error('NodeBB address in use, exiting...');
|
||||
process.exit(1);
|
||||
if (cluster.isWorker) {
|
||||
cluster.worker.kill();
|
||||
} else {
|
||||
process.exit(0);
|
||||
}
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
@@ -133,7 +137,7 @@ if(nconf.get('ssl')) {
|
||||
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);
|
||||
|
||||
server.listen(port, nconf.get('bind_address'), function(){
|
||||
server.listen(port, nconf.get('bind_address'), function() {
|
||||
winston.info('NodeBB is now listening on: ' + bind_address);
|
||||
if (process.send) {
|
||||
process.send({
|
||||
|
||||
Reference in New Issue
Block a user