Open bobgubko opened 1 month ago
It seems like there is some kind of edge case when closing a queue where the queue maybe has not been completely established. In any case I would recommend to create the queue outside of the process function as that would be much more performant instead of making a new connection to Redis, load all BullMQ commands and so on per job.
Version
v5.12
Platform
NodeJS
What happened?
I'm getting random
Connection is closed.
errors from my repeating jobs. Simplified example below. If I comment out that 2ms delay OR increase the delay to around 6-8ms, error goes away. Probably it has something to do with that 5ms delay in queue-base.ts?As a fix I moved queue creation (
const baz = new Queue('baz'...
) infoo.ts
out of default function scope, so it does not get created/closed every time worker runs. Is it a good practice to create queue on each run or better to have 1 instance?How to reproduce.
producer.ts
workers.ts
foo.ts
node dist/producer.js; node dist/workers.js
Relevant log output
Code of Conduct