Prioritise delayed jobs
Created by: alexkh13
Description
When adding delayed jobs with priority to the queue, the priority is not affecting its placement in the waiting list.
Test code to reproduce
var normalPriority = [],
highPriority = [];
highPriority.push(queue.add({p: 1}, {priority: 1, delay:2000}));
for(var i = 0; i < 4; i++){
normalPriority.push(queue.add({p: 2}, {priority: 2}));
}
Promise.all(normalPriority, highPriority).then(function(){
queue.process(function(job, jobDone){
console.log(job.data.p);
setTimeout(jobDone, 1000);
});
});
The expected output of the above should be 2,2,1,2,2 But indeed we get 2,2,2,2,1
Bull version
Latest
Additional information
This is, of course, relevant to repeatable jobs as well