Comparing version
@@ -0,1 +1,8 @@ | ||
# [4.5.0](https://github.com/OptimalBits/bull/compare/v4.4.0...v4.5.0) (2022-02-01) | ||
### Features | ||
* **queue:** add retryJobs for failed status ([501b2cc](https://github.com/OptimalBits/bull/commit/501b2cc49ccd0d7de82fea50144b52fa9879d1f5)) | ||
# [4.4.0](https://github.com/OptimalBits/bull/compare/v4.3.0...v4.4.0) (2022-01-26) | ||
@@ -2,0 +9,0 @@ |
@@ -729,2 +729,15 @@ 'use strict'; | ||
/** | ||
* Retry all the failed jobs. | ||
* | ||
* @param opts.count - number to limit how many jobs will be moved to wait status per iteration | ||
* @returns | ||
*/ | ||
Queue.prototype.retryJobs = async function(opts = {}) { | ||
let cursor = 0; | ||
do { | ||
cursor = await scripts.retryJobs(this, opts.count); | ||
} while (cursor); | ||
}; | ||
/** | ||
Adds an array of jobs to the queue. | ||
@@ -731,0 +744,0 @@ @method add |
@@ -117,2 +117,25 @@ /** | ||
retryJobsArgs( | ||
queue, | ||
count, | ||
) { | ||
const keys = [ | ||
queue.toKey(''), | ||
queue.toKey('failed'), | ||
queue.toKey('wait'), | ||
]; | ||
const args = [count]; | ||
return keys.concat(args); | ||
}, | ||
async retryJobs(queue, count = 1000){ | ||
const client = await queue.client; | ||
const args = this.retryJobsArgs(queue, count); | ||
return (client).retryJobs(args); | ||
}, | ||
moveToFinishedArgs( | ||
@@ -119,0 +142,0 @@ job, |
{ | ||
"name": "bull", | ||
"version": "4.4.0", | ||
"version": "4.5.0", | ||
"description": "Job manager", | ||
@@ -5,0 +5,0 @@ "engines": { |
182832
1.14%42
2.44%3352
0.87%