Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Jobs can only emit once

  • Loading branch information...
commit ad2f6952a5fb69e0b41ea4ff54b6b859cc269c9d 1 parent 5dfb970
@chriso authored
Showing with 4 additions and 5 deletions.
  1. +3 −5 lib/node.io/job.js
  2. +1 −0  lib/node.io/process_worker.js
View
8 lib/node.io/job.js 100755 → 100644
@@ -44,10 +44,8 @@ var Job = exports.JobProto = function (options) {
this.options = utils.put_default(options, default_options);
//Add data validation methods
- var val = new validator.Validator(), self = this;
- val.error = function (msg) {
- self.fail(self.assigned_input, msg);
- };
+ var val = new validator.Validator();
+ val.error = this.fail_with.bind(this);
this.assert = val.check.bind(val);
};
@@ -68,7 +66,7 @@ Job.prototype.reset = function () {
this.next = {};
}
-//Each job creates a new class/prototype so that the underlying Job.prototype is untouched
+//Each call creates a new class/prototype so that the underlying Job.prototype is untouched
exports.__defineGetter__('JobClass', function () {
var JobClass = function (options, methods) {
utils.put(JobClass.prototype, methods);
View
1  lib/node.io/process_worker.js
@@ -135,6 +135,7 @@ Processor.prototype.setupWorkerEvents = function (job, master) {
instance.emit = function (result) {
worker.emit('output', result);
instance.cancel_timeout();
+ instance.isComplete = true;
var emit = function () {
job.instances--;
Please sign in to comment.
Something went wrong with that request. Please try again.