Skip to content

Commit 5f957d0

Browse files
committed
postpone removing of hsetnx max_attempts on every attempt call
1 parent fce2720 commit 5f957d0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎lib/queue/job.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,14 @@ Job.prototype.attempt = function (fn) {
411411
, id = this.id
412412
, key = 'q:job:' + id;
413413

414-
// client.hsetnx(key, 'max_attempts', 1, function () {
414+
//TODO this now can be removed, since max_attempts is set in the constructor
415+
client.hsetnx(key, 'max_attempts', 1, function () {
415416
client.hget(key, 'max_attempts', function (err, max) {
416417
client.hincrby(key, 'attempts', 1, function (err, attempts) {
417418
fn(err, Math.max(0, max - attempts), attempts, max);
418419
});
419420
});
420-
// });
421+
});
421422

422423
return this;
423424
};

0 commit comments

Comments
 (0)