-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
8c3bf1f
commit 09ce146
Showing
12 changed files
with
166 additions
and
114 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,16 @@ | ||
--[[ | ||
Function to add job considering priority. | ||
]] | ||
|
||
local function addJobWithPriority(priorityKey, priority, jobId, targetKey) | ||
rcall("ZADD", priorityKey, priority, jobId) | ||
local count = rcall("ZCOUNT", priorityKey, 0, priority) | ||
|
||
local len = rcall("LLEN", targetKey) | ||
local id = rcall("LINDEX", targetKey, len - (count - 1)) | ||
if id then | ||
rcall("LINSERT", targetKey, "BEFORE", id, jobId) | ||
else | ||
rcall("RPUSH", targetKey, jobId) | ||
end | ||
end |
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,12 @@ | ||
--[[ | ||
Function to check for the meta.paused key to decide if we are paused or not | ||
(since an empty list and !EXISTS are not really the same). | ||
]] | ||
|
||
local function getTargetQueueList(queueMetaKey, waitKey, pausedKey) | ||
if rcall("EXISTS", queueMetaKey) ~= 1 then | ||
return waitKey, false | ||
else | ||
return pausedKey, true | ||
end | ||
end |
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
Oops, something went wrong.