why is queue.close() too slow.. and why is it not empty?
Created by: snawaz
queue.close()
takes almost 0.5 secs
to complete and debugging further, I found that line #1269
is being slow (inside whenCurrentJobsFinished
which is being called by .close()
).
I splitted the line to measure the time elapsed as follows:
const t1 = new Date().getTime();
await Promise.all(this.processing);
console.log("elapsed: ", (new Date().getTime() - t1)/1000); // this reports almost 0.5 seconds!
return forcedReconnection;
Interestingly, my service does not add any job to the queue, yet this.processing.length
is 4
. Why is it not 0
?
I"m using v3.22.0
but this code has not changed since then. Not sure if the other part of codebase makes this efficient in the recent version. I'm planning to use bullmq
(nestjs/bullmq
) instead. Just want to know if this slowness is known and acceptable?