Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
garo opened this Issue · 2 comments

3 participants

@garo

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);
});
job.save();

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.

@habicm

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

@behrad behrad was assigned
@behrad
Owner

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.