Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is rule of QueueScheduler? #330

Closed
Glyphack opened this issue Dec 9, 2020 · 2 comments
Closed

What is rule of QueueScheduler? #330

Glyphack opened this issue Dec 9, 2020 · 2 comments

Comments

@Glyphack
Copy link

Glyphack commented Dec 9, 2020

according to docs we need a queue scheduler in order to have delayed jobs and from docs example one has to declare it like:

import { Queue, QueueScheduler } from 'bullmq'

const myQueueScheduler = new QueueScheduler('Paint');
const myQueue = new Queue('Paint');

// Add a job that will be delayed at least 5 seconds.
await myQueue.add('house', { color: 'white' }, { delay: 5000 });

My question is that isn't there any functionality we want from a queue scheduler? as we are working with the basic Queue to add jobs.
so The above example and this one is equivalent:

import { Queue, QueueScheduler } from 'bullmq'

new QueueScheduler('Paint');
const myQueue = new Queue('Paint');

// Add a job that will be delayed at least 5 seconds.
await myQueue.add('house', { color: 'white' }, { delay: 5000 });
@marcjlyoung
Copy link

Both examples will work.

I believe you only need to instantiate the queue scheduler so it establishes a connection to Redis in order to setup the delayed jobs.

@manast
Copy link
Contributor

manast commented Dec 15, 2020

@Glyphack somewhere you probably want to have a graceful shutdown and in that place call myScheduler.close()

@manast manast closed this as completed Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants