[Feature] Call Worker and QueueScheduler methods without launching the process
See original GitHub issueManually processing jobs like this: https://docs.bullmq.io/patterns/manually-fetching-jobs can cause problems because new Worker
launches the process instantly. This can cause a lot of unpredictable effects in support scripts if I just want to manually resolve issues in a queue without processing any single job from there.
Is it possible to add a constructor option to prevent the process from being launched instantly. Like:
const worker = new Worker(name, () => {}, {autorun: false})
Overall, I think calling run()
in constructor is an anti-pattern: you don’t make all the methods of Worker
class easily accessible this way.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
So how does RxJS QueueScheduler actually work?
'of' by default (with no Scheduler) calls 'fromArray' which uses ... Subject.next method works in a synchronous way- what we have here is...
Read more >queueScheduler - RxJS
When used without delay, it schedules given task synchronously - executes it right when it is scheduled. However when called recursively, that is...
Read more >queueScheduler in rx.js 6.3 is synchronous - why this example ...
Seems like I understood why queue scheduler is working without SO. ... action.execute causes onNext function to be run again.
Read more >Process Scheduling - Rutgers CS
Preemptive scheduling allows the scheduler to control response times by taking the CPU away from a process that it decided has been running...
Read more >Scheduling Tasks in Python with Redis Queue and RQ ... - Twilio
Before being able to run this code, you have to make sure you're running a Redis server, an RQ worker, and the RQ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bogdan regarding my comment above. Although technically you do not need to duplicate the connection, in practice whatever connection you use will be blocked as soon as you call
getNextJob
. So I think the duplication makes sense to be performed always to avoid weirs issues where the user expects something to happen but nothing happens because the connection is blocked.@roggervalf looks good! Can you also add methods I mentioned in https://github.com/taskforcesh/bullmq/issues/436#issuecomment-804891421 or can I open another issue to add them?