Comparing version 0.4.1 to 0.5.0
@@ -418,3 +418,9 @@ var os = require('os'), | ||
this.forEach(function(worker) { | ||
worker.remoteCall.apply(worker, args); | ||
if (worker.ready) { | ||
worker.remoteCall.apply(worker, args); | ||
} else { | ||
worker.on('ready', function(a) { | ||
worker.remoteCall.apply(worker, args); | ||
}.bind(worker, args)) | ||
} | ||
}); | ||
@@ -421,0 +427,0 @@ }; |
@@ -192,2 +192,4 @@ var cluster = require('cluster'), | ||
this.ready = false; | ||
/** | ||
@@ -199,3 +201,2 @@ * Listen for cluster#fork and worker events. | ||
this.on('online', this._onOnline.bind(this)); | ||
this.on('listening', this._onListening.bind(this)); | ||
this.on('disconnect', this._onDisconnect.bind(this)); | ||
@@ -211,4 +212,10 @@ this.on('exit', this._onExit.bind(this)); | ||
this.on('initialized', this._onInitialized.bind(this)); | ||
this.on('ready', this._onReady.bind(this)); | ||
}); | ||
WorkerWrapper.prototype._onReady = function() { | ||
this.ready = true; | ||
}; | ||
/** | ||
@@ -277,2 +284,3 @@ * @event Master#'worker initialized' | ||
/*jshint unused:false*/ | ||
this.ready = false; | ||
this._setState(WorkerWrapper.STATES.STOPPED); | ||
@@ -286,2 +294,3 @@ }; | ||
WorkerWrapper.prototype._onDisconnect = function() { | ||
this.ready = false; | ||
this._setState(WorkerWrapper.STATES.STOPPING); | ||
@@ -313,19 +322,6 @@ }; | ||
WorkerWrapper.prototype._onInitialized = function() { | ||
if (typeof this.options.port === 'undefined') { | ||
this.emit('ready'); | ||
} | ||
this.emit('ready'); | ||
}; | ||
/** | ||
* event:_worker#listening handler | ||
* @fires WorkerWrapper#ready | ||
* @private | ||
*/ | ||
WorkerWrapper.prototype._onListening = function() { | ||
if (typeof this.options.port !== 'undefined') { | ||
this.emit('ready'); | ||
} | ||
}; | ||
/** | ||
* event:cluster#fork handler | ||
@@ -332,0 +328,0 @@ * @private |
{ | ||
"name" : "luster", | ||
"version" : "0.4.1", | ||
"version" : "0.5.0", | ||
"description" : "Node.js cluster wrapper", | ||
@@ -5,0 +5,0 @@ "main" : "./lib/luster.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104432