Files
simple-mail-cleaner/backend/node_modules/bullmq/dist/cjs/commands/includes/removeLock.lua
2026-01-22 15:49:12 +01:00

20 lines
468 B
Lua

local function removeLock(jobKey, stalledKey, token, jobId)
if token ~= "0" then
local lockKey = jobKey .. ':lock'
local lockToken = rcall("GET", lockKey)
if lockToken == token then
rcall("DEL", lockKey)
rcall("SREM", stalledKey, jobId)
else
if lockToken then
-- Lock exists but token does not match
return -6
else
-- Lock is missing completely
return -2
end
end
end
return 0
end