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

fix: Management of BullMQ queue prefixes #3220

Open
wants to merge 3 commits into
base: minor
Choose a base branch
from

Conversation

areg-gareginyan-im
Copy link

Description

In my project i planned to use same Redis for multiple Vendure instances, and wanted to separate BullMQ queus using worker/queue prefixes. However, current implementation had 2 issues:

  1. replacing ALL passed worker options by default values
  2. assuming that all redis scripts should be executed vs 'bull:*' queues, which contradicts with worker/queue options

NB: I know that passing in a db to the connection options would be a viable way to achieve my goal as stated in #2645, however making worker/queue prefixes work as they should be IMO is a nice thing.

Breaking changes

None

Screenshots

You can add screenshots here if applicable.

Checklist

📌 Always:

  • I have set a clear title
  • My PR is small and contains a single feature
  • I have checked my own PR

👍 Most of the time:

  • I have added or updated test cases
  • I have updated the README if needed

- current implementation had 2 issues:
        - replacing ALL passed worker options by default values
        - assuming that all redis scripts should be executed vs 'bull:*' queues, which contradics with worker/queue options
Copy link

vercel bot commented Nov 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Nov 22, 2024 10:54am

Copy link
Contributor

github-actions bot commented Nov 20, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@areg-gareginyan-im
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@areg-gareginyan-im
Copy link
Author

recheck

@dlhck
Copy link
Collaborator

dlhck commented Nov 20, 2024

@michaelbromley I think this is a good first fix, but we need to check if there are any dependencies on this bull: prefix.

github-actions bot added a commit that referenced this pull request Nov 21, 2024
const options = injector.get<BullMQPluginOptions>(BULLMQ_PLUGIN_OPTIONS);
this.options = {
...options,
workerOptions: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please spread the configured worker options in there with ...(options.workerOptions ?? {}) instead of assigning it the bottom.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, pls see updated version.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@areg-gareginyan-im the default values of removeOnComplete and removeOnFail should be kept. If you are passing workerOptions now they would be lost.

@areg-gareginyan-im
Copy link
Author

recheck

@dlhck
Copy link
Collaborator

dlhck commented Nov 21, 2024

recheck

@areg-gareginyan-im the CLA already worked. Could you please fix the things from my code review?

@areg-gareginyan-im areg-gareginyan-im changed the base branch from minor to master November 22, 2024 10:52
@areg-gareginyan-im areg-gareginyan-im changed the base branch from master to minor November 22, 2024 10:52
Copy link

sonarcloud bot commented Nov 22, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
11.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

const options = injector.get<BullMQPluginOptions>(BULLMQ_PLUGIN_OPTIONS);
this.options = {
...options,
workerOptions: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@areg-gareginyan-im the default values of removeOnComplete and removeOnFail should be kept. If you are passing workerOptions now they would be lost.

@dlhck
Copy link
Collaborator

dlhck commented Nov 25, 2024

@areg-gareginyan-im could you please fix the things from the last code review, then we can finally merge it. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants