-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(queue): add getCountsPerPriority method (#2595)
- Loading branch information
1 parent
a5a0af8
commit 77971f4
Showing
4 changed files
with
84 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--[[ | ||
Get counts per provided states | ||
Input: | ||
KEYS[1] wait key | ||
KEYS[2] prioritized key | ||
ARGV[1...] priorities | ||
]] | ||
local rcall = redis.call | ||
local results = {} | ||
local waitKey = KEYS[1] | ||
local prioritizedKey = KEYS[2] | ||
|
||
for i = 1, #ARGV do | ||
local priority = tonumber(ARGV[i]) | ||
if priority == 0 then | ||
results[#results+1] = rcall("LLEN", waitKey) | ||
else | ||
results[#results+1] = rcall("ZCOUNT", prioritizedKey, | ||
priority * 0x100000000, (priority + 1) * 0x100000000 - 1) | ||
end | ||
end | ||
|
||
return results |
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