Skip to content

Commit 75cabcb

Browse files
committed
Merge pull request #49 from dimichgh/master
Fixed unit tests, port of null exception during startup, compile errors
2 parents d820198 + 37222f0 commit 75cabcb

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

lib/index.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,17 @@ Cluster.prototype.listen = function(createApp, cb) {
184184
process.exit(-1);
185185
}
186186
});
187-
server.listen(port[index], host, function() { //'listening' listener
188-
exitIfBusyPort(host, port, index-1, function(){
189-
server.close();
190-
cb();
191-
})
192-
});
187+
if (require('cluster').isMaster) {
188+
server.listen(port[index], host, function() { //'listening' listener
189+
exitIfBusyPort(host, port, index-1, function(){
190+
server.close();
191+
cb();
192+
})
193+
});
194+
}
195+
else {
196+
process.nextTick(cb);
197+
}
193198
}
194199

195200
return self;

lib/process.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,9 @@ Process.prototype.listen = function() {
582582
var recycle = setInterval(function() {
583583

584584
var uptime = process.uptime();
585-
if(totalConns > connThreshold || uptime >= uptimeThreshod) {
585+
if(totalConns > connThreshold || uptime >= uptimeThreshold) {
586586

587-
log('[cluster2] exit because of connThreshold:' + connThreshold + ':' + totalConns + '; or uptime:' + uptime + ' has exceeded:' + uptimeThreshod);
587+
log('[cluster2] exit because of connThreshold:' + connThreshold + ':' + totalConns + '; or uptime:' + uptime + ' has exceeded:' + uptimeThreshold);
588588
clearInterval(recycle);
589589

590590
//wait for master's order

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"email": "subbu@ebaysf.com"
66
}],
77
"name": "cluster2",
8-
"version": "0.4.19",
8+
"version": "0.4.20",
99
"repository": {
1010
"type": "git",
1111
"url": "https://github.com/ql-io/cluster2"

test/cluster-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,9 @@ module.exports = {
282282
});
283283
}
284284
// Send shutdown while requests are in-flight
285-
shutdown(emitter);
285+
setTimeout(function() {
286+
shutdown(emitter);
287+
}, 10);
286288
});
287289

288290
emitter.on('start failure', function (error) {

0 commit comments

Comments
 (0)