Skip to content
This repository
Browse code

Jobs can only emit once

  • Loading branch information...
commit ad2f6952a5fb69e0b41ea4ff54b6b859cc269c9d 1 parent 5dfb970
Chris O'Hara authored

Showing 2 changed files with 4 additions and 5 deletions. Show diff stats Hide diff stats

  1. +3 5 lib/node.io/job.js
  2. +1 0  lib/node.io/process_worker.js
8 lib/node.io/job.js 100755 → 100644
@@ -44,10 +44,8 @@ var Job = exports.JobProto = function (options) {
44 44 this.options = utils.put_default(options, default_options);
45 45
46 46 //Add data validation methods
47   - var val = new validator.Validator(), self = this;
48   - val.error = function (msg) {
49   - self.fail(self.assigned_input, msg);
50   - };
  47 + var val = new validator.Validator();
  48 + val.error = this.fail_with.bind(this);
51 49 this.assert = val.check.bind(val);
52 50 };
53 51
@@ -68,7 +66,7 @@ Job.prototype.reset = function () {
68 66 this.next = {};
69 67 }
70 68
71   -//Each job creates a new class/prototype so that the underlying Job.prototype is untouched
  69 +//Each call creates a new class/prototype so that the underlying Job.prototype is untouched
72 70 exports.__defineGetter__('JobClass', function () {
73 71 var JobClass = function (options, methods) {
74 72 utils.put(JobClass.prototype, methods);
1  lib/node.io/process_worker.js
@@ -135,6 +135,7 @@ Processor.prototype.setupWorkerEvents = function (job, master) {
135 135 instance.emit = function (result) {
136 136 worker.emit('output', result);
137 137 instance.cancel_timeout();
  138 + instance.isComplete = true;
138 139
139 140 var emit = function () {
140 141 job.instances--;

0 comments on commit ad2f695

Please sign in to comment.
Something went wrong with that request. Please try again.