Question: queue.getJobs() race condition
Created by: fyodorvi
From getJobs()
implementation I can see that unlike getJobCounts()
you don't use transaction to get the jobs, which is potentially very dangerous since you might have jobs transitioning state while you are getting every state separately:
queue.getJobs(['active', 'waiting']);
Job 1 is in waiting state. getJobs gets 'active' jobs => [] (empty array) Job 1 transitions to active state getJobs gets 'waiting' jobs => [] (empty array)
Could you please tell me if I'm wrong, or clarify why it's done without a transaction or tell me it's a bug.
Thanks.