re enqueue job as the first element in the :waiting list
Description
Hi @manast ! First of all, thanks for this awesome library!
When a job fails (with N attempts and backoff = 0 ) it gets re-enqueued on the :waiting list as the last item to be processed (left-side in a FIFO queue). We have a pool of workers that processes jobs from different queues in a round-robin approach and we need to re-process that failed job in the next iteration. Is there any way to put that job as the first (right-side) element in the waiting list ?
Thanks in advance for your time and support!
I think that if you use a backoff of say 1ms then the job would go to the delay set, then after 1ms moved back at the first position of the queue.
Hey @manast , sorry for the delayed response! I've tried with so many options ( including a backoff of 1 ms) and i could not succeed
Here is a code snippet with the case:
import Queue from "bull";
var queue = new Queue("foo", "redis://redis:6379", {
defaultJobOptions: {
attempts: Number.MAX_SAFE_INTEGER,
backoff: {
type: "fixed",
delay: 1
},
removeOnComplete: true
}
});
queue.add(1, { jobId: 1 });
queue.add(2, { jobId: 2 });
queue.add(3, { jobId: 3 });
queue.process(async job => {
console.log("process job", job.id);
return Promise.reject(new Error("bar"));
});
and the output is the following:
process job 1
process job 2
process job 3
then it is not possible with current implementation...