-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add queue fetch balance strategy
The Redis API used to fetch jobs (([brpop](https://redis.io/docs/latest/commands/brpop/)) checks queues for jobs in the order the queues are provided. This means that if the first queue in the list provided to `Processor::new` always has an item, the other queues will never have their jobs run. Add a `BalanceStrategy` to allow ensuring that no queue is starved indefinitely. The initial (and default) algorithm implemented is a basic round robin algorithm. Before each fetch from Redis, the `Processor#queues` list is rotated by 1, ensuring that every queue has a chance to have its jobs run.
- Loading branch information
1 parent
c35bb46
commit ab61a8f
Showing
3 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters