-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(queue): different score purpose per state #2133
Changes from 3 commits
2219498
7695e43
6d90230
32ee8cf
35f4a44
1cb3163
4ccb045
3d1cb37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,17 @@ | |
-- of items in a sorted set only run a single iteration. If we simply used | ||
-- ZRANGE, we may take a long time traversing through jobs that are within the | ||
-- grace period. | ||
local function getJobsInZset(zsetKey, rangeStart, rangeEnd, maxTimestamp, limit) | ||
local function getJobsInZset(zsetKey, rangeStart, rangeEnd, maxTimestamp, limit, useTimestampAsScore) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am confused, why aren't we using rangeEnd anymore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rangeStart is not used anymore either 🤔 |
||
local endRange | ||
if useTimestampAsScore then | ||
endRange = maxTimestamp | ||
else | ||
endRange = "+inf" | ||
end | ||
|
||
if limit > 0 then | ||
return rcall("ZRANGEBYSCORE", zsetKey, 0, maxTimestamp, "LIMIT", 0, limit) | ||
return rcall("ZRANGEBYSCORE", zsetKey, 0, endRange, "LIMIT", 0, limit) | ||
else | ||
return rcall("ZRANGE", zsetKey, rangeStart, rangeEnd) | ||
return rcall("ZRANGEBYSCORE", zsetKey, 0, endRange) | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think better to consider <= as for completed and failed we can bring all the expected jobs in ZRANGEBYSCORE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need more context to understand this 😅