Projektstart
This commit is contained in:
26
backend/node_modules/bullmq/dist/cjs/commands/includes/handleDuplicatedJob.lua
generated
vendored
Normal file
26
backend/node_modules/bullmq/dist/cjs/commands/includes/handleDuplicatedJob.lua
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
--[[
|
||||
Function to handle the case when job is duplicated.
|
||||
]]
|
||||
|
||||
-- Includes
|
||||
--- @include "updateExistingJobsParent"
|
||||
|
||||
local function handleDuplicatedJob(jobKey, jobId, currentParentKey, currentParent,
|
||||
parentData, parentDependenciesKey, completedKey, eventsKey, maxEvents, timestamp)
|
||||
local existedParentKey = rcall("HGET", jobKey, "parentKey")
|
||||
|
||||
if not existedParentKey or existedParentKey == currentParentKey then
|
||||
updateExistingJobsParent(currentParentKey, currentParent, parentData,
|
||||
parentDependenciesKey, completedKey, jobKey,
|
||||
jobId, timestamp)
|
||||
else
|
||||
if currentParentKey ~= nil and currentParentKey ~= existedParentKey
|
||||
and (rcall("EXISTS", existedParentKey) == 1) then
|
||||
return -7
|
||||
end
|
||||
end
|
||||
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event",
|
||||
"duplicated", "jobId", jobId)
|
||||
|
||||
return jobId .. "" -- convert to string
|
||||
end
|
||||
Reference in New Issue
Block a user