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
Now we're migrating to bullmq: ^1.86.1, so how do we accomplish the same using bullmq?
I"m trying this. But I'm not sure if it's even close to what the above is trying to accomplish! 🤔
asyncfunctionaccelerate(q: Queue<unknown>,deltaMs: number): Promise<void>{awaitnewPromise((resolve)=>setTimeout(resolve,300));// how about this?constjobs=awaitq.getDelayed();awaitPromise.all(jobs.map(async(job)=>awaitjob.changeDelay(deltaMs)));awaitnewPromise((resolve)=>setTimeout(resolve,300));//how about this?}
The text was updated successfully, but these errors were encountered:
Turned out. I was almost there. So instead of using deltaMs, I used -deltaMs (i.e use negative value).
asyncfunctionaccelerate(q: Queue<unknown>,deltaMs: number): Promise<void>{awaitnewPromise((resolve)=>setTimeout(resolve,300));// give bullmq time to move jobs constjobs=awaitq.getDelayed();awaitPromise.all(jobs.map(async(job)=>awaitjob.changeDelay(-deltaMs)));// NOTEawaitnewPromise((resolve)=>setTimeout(resolve,300));// give bullmq time to move jobs}
Well, the sign of deltaMs actually depends on how we pass this value. So here it's:
awaitaccelerate(myQueue,ms("8d"));// I use 1d more so that by this time the job will be executed
In our tests, we have some jobs to be executed, say
7d
later. How do we fast forward the jobs in the queue so that we can test such scenarios?Using
bull: 3.22.0
, we used to do this (written by someone before I joined the team):This used to work.
Now we're migrating to
bullmq: ^1.86.1
, so how do we accomplish the same usingbullmq
?I"m trying this. But I'm not sure if it's even close to what the above is trying to accomplish! 🤔
The text was updated successfully, but these errors were encountered: