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

Give ability to disable job processing in BullModule.forRoot method #2017

Open
1 task done
leonardbinet opened this issue Feb 26, 2024 · 3 comments
Open
1 task done
Labels

Comments

@leonardbinet
Copy link

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

In our architecture, we have two types of "applications", that share the same code:

  • web servers: serve clients requests
  • workers: process bullmq jobs

We would like to be able disable job processing on some instances only.

Describe the solution you'd like

In BullModule.forRoot method, have a disabled prop, to disable the processing of jobs on this instance.

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

Be able to easily disable processing.

@kamilmysliwiec
Copy link
Member

What about not importing BullModule.forRoot in the context of a web server application?

@jarPotato
Copy link

@kamilmysliwiec will the web server still be able to produce messages if BullModule is not initialised at all?

@leonardbinet
Copy link
Author

@kamilmysliwiec sorry I didn't notice your answer, the concern is as @jarPotato states it that I still want to be able to send messages, I just want to disable the processing.

Currently our workaround is that we gathered all listeners/processors classes in a single module, that is imported conditionally based on an environment variable.

The issue with this pattern is that it's quite easy to accidentally import a listener/processor in the wrong module (or fail to catch this in a review), and thus have the wrong instances (web instead of workers) process the jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants