Ensure events are subscribed before jobs save #179

wants to merge 8 commits into


None yet

7 participants


The changes fix the case where the worker calls the done() function too quickly and the assigning node doesn't get the 'complete' (or other) event because it has not yet subscribed.




+1 Please merge 👍

@bulkan bulkan commented on the diff Jun 27, 2013
@@ -95,7 +95,7 @@ Worker.prototype.error = function(err, job){
Worker.prototype.failed = function(job, err, fn){
var self = this;
- events.emit(job.id, 'failed');
+ events.emit(job.id, 'failed', err.message || err);
bulkan Jun 27, 2013

These changes are same as the PR from #175 and fixes #170

@drudge we can close #175

drudge Jun 27, 2013

Is there a reason we try to pass the error message and not just the error object?

nathanbowser Jul 23, 2013

An error object isn't enumerable, and the error needs to be sent from the worker to the client that created the job. That architecture is implemented using redis, passing JSON messages.

@behrad behrad was assigned Jan 18, 2014
@behrad behrad closed this Jan 18, 2014
@behrad behrad was unassigned by laxels Mar 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment