Repository navigation
feat(queueing)!: give queue groups workers of their own - #17
Merged
Merged
Conversation
Every job shared one set of workers, so a burst of jobs could hold up the ones that must start at once. engine.Group registers jobs that run on an asynq server of their own, sized by config.Queue.Groups, while every other job keeps sharing the default workers by Queue() and Priority(). The queue now runs from config.Queue, passed with queueing.WithConfig, which is required, instead of reading QUEUE_* environment variables. Each set of workers can also poll an idle queue more often than asynq's 1s default (CheckInterval), so a job dispatched to an idle group starts sooner. BREAKING CHANGE: queueing needs queueing.WithConfig, NewEngine takes the config, and EngineResolver's Consume and Dispatch take the groups and the queue.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every job shared one set of workers, so a burst of jobs (mail, background work) could hold up the ones that must start at once.
Queue()byPriority()as before.CheckIntervallets a set of workers poll an idle queue more often than asynq's 1s default.config.Queueviaqueueing.WithConfig(required) instead ofQUEUE_*environment variables.Breaking: pass
queueing.WithConfig;NewEnginetakes the config;EngineResolver.ConsumeandDispatchtake the groups and the queue.Tested:
tests/queueingcovers the config, the queue a job is dispatched to, and how jobs and groups become servers, including the refusals. Against a real Redis, a job in a group with 1 worker started at once while the 2 default workers were busy with 6 jobs queued.Replaces #11 and #16.