-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
activeQueues
option not working as intended with BullMQ job queue strategy
#2419
Comments
activeQueues
option not working as intended with BullMQ strategyactiveQueues
option not working as intended with BullMQ job queue strategy
Duplicate of I did spend some time looking into this, and specifically started working on a proof-of-concept based on a separate BullMQ queue for each Vendure queue. That design would indeed make the However, it also comes with a some challenges I was not able to yet resolve:
These issues may also be solvable but they require more time. If you are interested in trying to solve, I would very much welcome assistance. |
Thanks for the quick response and the detailed explanation of the challenges involved. Regarding the pagination issue, one approach could be to maintain a centralized list of jobs that is updated whenever a job is added or removed from a queue. This list could then be used to fetch jobs for the job list. But I'm unsure about the performance implications, it could simplify the pagination logic. As for fetching individual jobs, we could combine the job ID and queue name into a single identifier. For example, the job ID could be formatted as I'm not certain if these approaches would work in practice, but I'm interested in hearing your thoughts. |
Yes, this would probably work.
The main issue with this is not the perf (redis is just mega fast), it's the fact that we would be re-implementing parts of BullMQ. Bull has some pretty sophisticated logic around how it manages its queues (as represented by the hundreds and hundreds of lines of custom Lua scripts that powers it), which is why I didn't opt for this route so far. So, both of these ideas are worth further exploration. |
Will this be considered in near future ? |
yes. We will optimize this and we already have a PR open that just needs to be finished. |
Description
When using the
activeQueues
option inJobQueueOptions
, the observed behavior with the BullMQ job queue strategy is inconsistent with expectations. All worker processes pull jobs from a single queue, even when differentactiveQueues
are specified. Consequently, jobs not listed in theactiveQueues
option are marked as failed by workers.`JobQueueOptions`
vendure/packages/core/src/config/vendure-config.ts
Lines 872 to 902 in 7549aad
In the BullMQ strategy, only one queue is created:
vendure/packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts
Lines 64 to 74 in 7549aad
Proposed Behavior
I believe a more robust solution would be to create a separate queue for each entry in the
activeQueues
option. Each worker process would then pull jobs only from its corresponding queue. While it might be possible to use a single queue and have each worker check theactiveQueues
before processing, this approach could introduce delays in job processing.When running multiple worker processes with defined
activeQueues
, jobs are pulled from the single queue. This causes jobs to fail if they are not defined inactiveQueues
.To Reproduce
activeQueues
.activeQueues
to fail rather than be skipped.Expected behavior
Each worker process should only process jobs from the queues listed in their
activeQueues
option. Ideally, separate queues should be created for eachactiveQueues
entry to avoid unnecessary delays in job processing.The text was updated successfully, but these errors were encountered: