You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there, just started using your package, everything seems perfect so far, except I'm looking for a way to get the position in the queue by job id. Is there a functionality for it or maybe some direction how to do this?
The text was updated successfully, but these errors were encountered:
I don't think the optimal solution exists, anyway linear search is required. With Bull you can simply do:
const waiting = await queue.getWaiting();
for (let i = 0; i < waiting.length; i++) {
const job = waiting[i];
if(job.id === someId) return i; // 0 means job is 1st in queue
}
Job priorities are also taken into account.
Faster solution will include lua scripting as described here https://stackoverflow.com/a/8925470. There is bull:queueName:wait key holding all queued jobs in value of type LIST, you can adapt script for this case and use ioredis to execute it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hey there, just started using your package, everything seems perfect so far, except I'm looking for a way to get the position in the queue by job id. Is there a functionality for it or maybe some direction how to do this?
The text was updated successfully, but these errors were encountered: