mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-25 23:15:51 +03:00
[PR #1066] Support Dynamic Queue Names with Wildcard Priorities config #1004
Labels
No labels
CLI
bug
designing
documentation
duplicate
enhancement
good first issue
good first issue
help wanted
idea
invalid
investigate
needs-more-info
performance
pr-welcome
pull-request
question
wontfix
work in progress
work in progress
work-around-available
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asynq#1004
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hibiken/asynq/pull/1066
Author: @arttor
Created: 8/1/2025
Status: 🔄 Open
Base:
master← Head:dynamic-queue📝 Commits (1)
b2c47d0support dynamic queue names📊 Changes
21 files changed (+1464 additions, -228 deletions)
View changed files
📝
aggregator.go(+5 -5)📝
aggregator_test.go(+1 -1)📝
forwarder.go(+7 -8)📝
forwarder_test.go(+6 -3)📝
go.mod(+1 -1)📝
heartbeat.go(+22 -23)📝
heartbeat_test.go(+16 -18)📝
inspector.go(+2 -0)📝
internal/base/base.go(+2 -0)📝
internal/rdb/rdb.go(+13 -0)📝
internal/testbroker/testbroker.go(+9 -0)📝
janitor.go(+5 -5)📝
janitor_test.go(+6 -3)📝
processor.go(+4 -40)📝
processor_test.go(+114 -95)➕
queue_manager.go(+356 -0)➕
queue_manager_test.go(+803 -0)📝
recoverer.go(+7 -6)📝
recoverer_test.go(+1 -1)📝
server.go(+63 -19)...and 1 more files
📄 Description
Closes #856
Allows workers to process dynamic queue names. Dynamic queue priorities can be set using wildcard (
*) patterns:criticalwill be processed first (priority 10):transfer:in its name (priority 7)email:important(priority 6)email:(priority 5)Implementation details
queueManagerthat periodically polls (by default every 5s) all existing queues from existing Redis SET AllQueues. The manager assigns priorities to new queues based on the wildcard configuration.Motivation
The feature addresses the use case described in #856, enabling dynamic queue creation at runtime (e.g., queue names based on domain objects - for us it is S3 bucket names for data migration). This is particularly useful for applications requiring flexible queue management without predefined queue names.
Side notes
Apologies for submitting a large PR without a prior design proposal. The API change is minimal, and the implementation is best understood by reviewing the source code. Feedback is welcome!
Future work
This PR lays the groundwork for addressing #850, which proposes dynamic queue priority configuration. Potential next steps include:
-1queueManagerto periodically fetch new queues with score-1and assign priorities based on the dynamic configuration.O(N)toO(1)for each message dequeue operation, whereNis number of queues in the config.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.