mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 12:16:54 +02:00
moved handle close to fork worker
This commit is contained in:
22
loader.js
22
loader.js
@@ -141,15 +141,6 @@ Loader.addClusterEvents = function(callback) {
|
||||
case 'config:update':
|
||||
Loader.notifyWorkers(message);
|
||||
break;
|
||||
case 'sticky-session:accept':
|
||||
var _handle = handles[message.handleIndex];
|
||||
|
||||
if (_handle) {
|
||||
_handle.close();
|
||||
|
||||
delete handles[message.handleIndex];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -229,6 +220,19 @@ function forkWorker(isPrimary) {
|
||||
worker.process.stdout.pipe(output);
|
||||
worker.process.stderr.pipe(output);
|
||||
}
|
||||
|
||||
worker.on('message', function(message) {
|
||||
if (!message || message.action !== 'sticky-session:accept') {
|
||||
return;
|
||||
}
|
||||
var _handle = handles[message.handleIndex];
|
||||
|
||||
if (_handle) {
|
||||
_handle.close();
|
||||
|
||||
delete handles[message.handleIndex];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function workerIndex(ip, numProcs) {
|
||||
|
||||
@@ -151,8 +151,8 @@ if(nconf.get('ssl')) {
|
||||
return;
|
||||
}
|
||||
|
||||
server.emit('connection', connection);
|
||||
process.send({action: 'sticky-session:accept', handleIndex: message.handleIndex});
|
||||
server.emit('connection', connection);
|
||||
});
|
||||
|
||||
}(WebServer));
|
||||
|
||||
Reference in New Issue
Block a user