Review funkt
This commit is contained in:
23
node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua
generated
vendored
Normal file
23
node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
--[[
|
||||
Function to remove deduplication key if needed
|
||||
when a job is moved to completed or failed states.
|
||||
]]
|
||||
|
||||
local function removeDeduplicationKeyIfNeededOnFinalization(prefixKey,
|
||||
deduplicationId, jobId)
|
||||
if deduplicationId then
|
||||
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
||||
local pttl = rcall("PTTL", deduplicationKey)
|
||||
|
||||
if pttl == 0 then
|
||||
return rcall("DEL", deduplicationKey)
|
||||
end
|
||||
|
||||
if pttl == -1 then
|
||||
local currentJobId = rcall('GET', deduplicationKey)
|
||||
if currentJobId and currentJobId == jobId then
|
||||
return rcall("DEL", deduplicationKey)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user