Skip to content


Subversion checkout URL

You can clone with
Download ZIP


job.on('failed') is called on first failed attempt, regardless if the job is set to retry #142

garo opened this Issue · 2 comments

3 participants


It seems that if a job try fails the job state is changed to 'failed' and thus the client will get the on('failed') call.

Example client code:

var job = jobs.create('my job', jobData).attempts(5);

job.on('complete', function (err, res) {
console.log("job completed. err:", err, ", res:", res);
callback(err, res);
}).on('failed', function (err, res) {
console.log("job failed. err:", err, ", res:", res);
callback(err, res);

Example server code:

jobs.process('my job', 5, function (job, done) {
done('error happens on first try');

Here the .on('failed' is called after the first attempt has failed. In my opinion it should be called only when all job attempts have failed. Another choice would be to distinct a single attempt failure from the job failure with another state event.


I found same issue here. Do you think to include this in a future version?

@behrad behrad was assigned

fixed in #256

@behrad behrad closed this
@behrad behrad was unassigned by garo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.