-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(scheduler): remove multi when updating a job scheduler (#3108)
- Loading branch information
1 parent
94008ac
commit 4b619ca
Showing
5 changed files
with
143 additions
and
108 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
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,41 @@ | ||
--[[ | ||
Add delay marker if needed. | ||
]] | ||
|
||
-- Includes | ||
--- @include "addDelayedJob" | ||
--- @include "addJobWithPriority" | ||
--- @include "isQueuePaused" | ||
--- @include "storeJob" | ||
|
||
local function addJobFromScheduler(jobKey, jobId, rawOpts, waitKey, pausedKey, metaKey, prioritizedKey, | ||
priorityCounter, delayedKey, markerKey, eventsKey, name, maxEvents, timestamp, data, jobSchedulerId) | ||
local opts = cmsgpack.unpack(rawOpts) | ||
|
||
local delay, priority = storeJob(eventsKey, jobKey, jobId, name, data, | ||
opts, timestamp, nil, nil, jobSchedulerId) | ||
|
||
if delay ~= 0 then | ||
addDelayedJob(jobId, delayedKey, eventsKey, timestamp, maxEvents, markerKey, delay) | ||
else | ||
local isPaused = isQueuePaused(metaKey) | ||
|
||
-- Standard or priority add | ||
if priority == 0 then | ||
if isPaused then | ||
-- LIFO or FIFO | ||
local pushCmd = opts['lifo'] and 'RPUSH' or 'LPUSH' | ||
rcall(pushCmd, pausedKey, jobId) | ||
else | ||
-- LIFO or FIFO | ||
local pushCmd = opts['lifo'] and 'RPUSH' or 'LPUSH' | ||
rcall(pushCmd, waitKey, jobId) | ||
end | ||
else | ||
-- Priority add | ||
addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounter, isPaused) | ||
end | ||
-- Emit waiting event | ||
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "waiting", "jobId", 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