Comparing version 3.19.1 to 3.20.0
# Changelog | ||
## v.3.20.0 | ||
- feat(job): implement Job#retriedOn (#1868) | ||
- fix: job default opts fixes #1904 | ||
[Changes](https://github.com/OptimalBits/bull/compare/v3.19.1...v3.20.0) | ||
## v.3.19.1 | ||
@@ -4,0 +11,0 @@ |
@@ -360,23 +360,15 @@ 'use strict'; | ||
this.processedOn = null; | ||
this.retriedOn = Date.now(); | ||
return this.queue.client | ||
.hdel( | ||
this.queue.toKey(this.id), | ||
'finishedOn', | ||
'processedOn', | ||
'failedReason' | ||
) | ||
.then((/*redisResult*/) => { | ||
return scripts.reprocessJob(this, { state: 'failed' }).then(result => { | ||
if (result === 1) { | ||
return; | ||
} else if (result === 0) { | ||
throw new Error(errors.Messages.RETRY_JOB_NOT_EXIST); | ||
} else if (result === -1) { | ||
throw new Error(errors.Messages.RETRY_JOB_IS_LOCKED); | ||
} else if (result === -2) { | ||
throw new Error(errors.Messages.RETRY_JOB_NOT_FAILED); | ||
} | ||
}); | ||
}); | ||
return scripts.reprocessJob(this, { state: 'failed' }).then(result => { | ||
if (result === 1) { | ||
return; | ||
} else if (result === 0) { | ||
throw new Error(errors.Messages.RETRY_JOB_NOT_EXIST); | ||
} else if (result === -1) { | ||
throw new Error(errors.Messages.RETRY_JOB_IS_LOCKED); | ||
} else if (result === -2) { | ||
throw new Error(errors.Messages.RETRY_JOB_NOT_FAILED); | ||
} | ||
}); | ||
}); | ||
@@ -620,2 +612,6 @@ }; | ||
if (json.retriedOn) { | ||
job.retriedOn = parseInt(json.retriedOn); | ||
} | ||
job.failedReason = json.failedReason; | ||
@@ -622,0 +618,0 @@ job.attemptsMade = parseInt(json.attemptsMade || 0); |
@@ -690,3 +690,3 @@ 'use strict'; | ||
} | ||
opts = { ...opts, ...this.defaultJobOptions }; | ||
opts = { ...this.defaultJobOptions, ...opts }; | ||
@@ -716,4 +716,4 @@ opts.jobId = jobIdForGroup(this.limiter, opts, data); | ||
opts: { | ||
...this.defaultJobOptions, | ||
...job.opts, | ||
...this.defaultJobOptions, | ||
jobId | ||
@@ -720,0 +720,0 @@ } |
@@ -451,3 +451,8 @@ /** | ||
const args = [job.id, (job.opts.lifo ? 'R' : 'L') + 'PUSH', queue.token]; | ||
const args = [ | ||
job.id, | ||
(job.opts.lifo ? 'R' : 'L') + 'PUSH', | ||
queue.token, | ||
Date.now() | ||
]; | ||
@@ -454,0 +459,0 @@ return queue.client.reprocessJob(keys.concat(args)); |
{ | ||
"name": "bull", | ||
"version": "3.19.1", | ||
"version": "3.20.0", | ||
"description": "Job manager", | ||
@@ -5,0 +5,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
920100