mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-26 07:25:56 +03:00
[GH-ISSUE #271] [QUESTION] How does priority queue work? #104
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#104
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?
Originally created by @sujit-baniya on GitHub (May 6, 2021).
Original GitHub issue: https://github.com/hibiken/asynq/issues/271
Originally assigned to: @hibiken on GitHub.
Please suggest how the priority queue works in following scenario:
There are already 1K messages on
low, When I send a message oncriticalwhile other messages are still enqueued, will this message consume at first or wait for first 1K to get completed?I'm trying to understand how priority queue works
@hibiken commented on GitHub (May 7, 2021):
@sujit-baniya thank you for asking!
It's documented here in godoc (https://pkg.go.dev/github.com/hibiken/asynq#Config). Please take a look at
QueuesandStrictPriorityfields. Also, there's a wiki page explaining how queue priorities work: https://github.com/hibiken/asynq/wiki/Queue-PriorityLet me know if it's still unclear! That means the documentation can be improved.
@sujit-baniya commented on GitHub (May 8, 2021):
@hibiken Thank you for your response. I understand the Queue Priority. I am trying to understand this..
@hibiken commented on GitHub (May 8, 2021):
Once a task is in pending state, it's appending to a list in redis. This list has FIFO semantics.
If a task is scheduled to be processed in the future (via
ProcessInorProcessAtoption), the task is stored in a sorted-set in redis (score being the unix time of the process_at time).Asynq internally manages these tasks state and move tasks from sorted-set to the FIFO list.
If you are interested in the redis key design, good place to start is base.go and rdb.go file.
@hibiken commented on GitHub (May 12, 2021):
Closing this issue.