Projektstart
This commit is contained in:
39
backend/node_modules/bullmq/dist/esm/commands/includes/addJobFromScheduler.lua
generated
vendored
Normal file
39
backend/node_modules/bullmq/dist/esm/commands/includes/addJobFromScheduler.lua
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
--[[
|
||||
Add delay marker if needed.
|
||||
]]
|
||||
|
||||
-- Includes
|
||||
--- @include "addDelayedJob"
|
||||
--- @include "addJobWithPriority"
|
||||
--- @include "isQueuePaused"
|
||||
--- @include "storeJob"
|
||||
--- @include "getTargetQueueList"
|
||||
--- @include "addJobInTargetList"
|
||||
|
||||
local function addJobFromScheduler(jobKey, jobId, opts, waitKey, pausedKey, activeKey, metaKey,
|
||||
prioritizedKey, priorityCounter, delayedKey, markerKey, eventsKey, name, maxEvents, timestamp,
|
||||
data, jobSchedulerId, repeatDelay)
|
||||
|
||||
opts['delay'] = repeatDelay
|
||||
opts['jobId'] = jobId
|
||||
|
||||
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 target, isPausedOrMaxed = getTargetQueueList(metaKey, activeKey, waitKey, pausedKey)
|
||||
|
||||
-- Standard or priority add
|
||||
if priority == 0 then
|
||||
local pushCmd = opts['lifo'] and 'RPUSH' or 'LPUSH'
|
||||
addJobInTargetList(target, markerKey, pushCmd, isPausedOrMaxed, jobId)
|
||||
else
|
||||
-- Priority add
|
||||
addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounter, isPausedOrMaxed)
|
||||
end
|
||||
-- Emit waiting event
|
||||
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "waiting", "jobId", jobId)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user