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
I created a Queue with some default job options, a Worker for this queue, and a Job. This works fine.
Then, using a separate script, I wanted to add another job to the same queue, so that it would get processed by the existing worker. It does, but the default job options assigned initially to the queue are ignored.
I expected the original options to be obeyed, after all the documentation states: When you instantiate a Queue, BullMQ will just upsert a small "meta-key", so if the queue existed before it will just pick it up and you can continue adding jobs to it..
But why? This would mean that the default options are, well... not always default. This seems inconsistent to me, or perhaps I'm getting something wrong?
How to reproduce.
Main file: file1.ts
const queue = new Queue(
"my-queue",
{
connection,
defaultJobOptions: {
delay: 5000
}
},
);
new Worker(
"my-queue",
async (job) => {
console.log(job.name);
},
{
connection
}
);
const job = queue.add("my-regular-job", {}); // this job will get executed after 5 seconds, this is fine
Second file: file2.ts
const queue = new Queue(
"my-queue",
{
connection,
}
);
const job = queue.add("my-external-test-job", {}); // this job gets executed immediately, ignoring the default job options set in file1
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Version
v5.12.5
Platform
NodeJS
What happened?
I created a Queue with some default job options, a Worker for this queue, and a Job. This works fine.
Then, using a separate script, I wanted to add another job to the same queue, so that it would get processed by the existing worker. It does, but the default job options assigned initially to the queue are ignored.
I expected the original options to be obeyed, after all the documentation states:
When you instantiate a Queue, BullMQ will just upsert a small "meta-key", so if the queue existed before it will just pick it up and you can continue adding jobs to it.
.At the same time, one of your developers stated that the queue's
defaultJobOptions
are not persisted.But why? This would mean that the default options are, well... not always default. This seems inconsistent to me, or perhaps I'm getting something wrong?
How to reproduce.
Main file:
file1.ts
Second file:
file2.ts
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: