question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Call Worker and QueueScheduler methods without launching the process

See original GitHub issue

Manually 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:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
manastcommented, Sep 3, 2021

@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.

0reactions
bogdancommented, Sep 2, 2021

@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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found