template-saas/apps/backend/node_modules/bullmq/dist/cjs/commands/removeRepeatable-3.lua
rckrdmrd 50a821a415
Some checks failed
CI / Backend CI (push) Has been cancelled
CI / Frontend CI (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / CI Summary (push) Has been cancelled
[SIMCO-V38] feat: Actualizar a SIMCO v3.8.0
- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8
- Actualizaciones de configuracion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:53:08 -06:00

59 lines
1.3 KiB
Lua

--[[
Removes a repeatable job
Input:
KEYS[1] repeat jobs key
KEYS[2] delayed jobs key
KEYS[3] events key
ARGV[1] old repeat job id
ARGV[2] options concat
ARGV[3] repeat job key
ARGV[4] prefix key
Output:
0 - OK
1 - Missing repeat job
Events:
'removed'
]]
local rcall = redis.call
local millis = rcall("ZSCORE", KEYS[1], ARGV[2])
-- Includes
--- @include "includes/removeJobKeys"
-- legacy removal TODO: remove in next breaking change
if millis then
-- Delete next programmed job.
local repeatJobId = ARGV[1] .. millis
if(rcall("ZREM", KEYS[2], repeatJobId) == 1) then
removeJobKeys(ARGV[4] .. repeatJobId)
rcall("XADD", KEYS[3], "*", "event", "removed", "jobId", repeatJobId, "prev", "delayed");
end
end
if(rcall("ZREM", KEYS[1], ARGV[2]) == 1) then
return 0
end
-- new removal
millis = rcall("ZSCORE", KEYS[1], ARGV[3])
if millis then
-- Delete next programmed job.
local repeatJobId = "repeat:" .. ARGV[3] .. ":" .. millis
if(rcall("ZREM", KEYS[2], repeatJobId) == 1) then
removeJobKeys(ARGV[4] .. repeatJobId)
rcall("XADD", KEYS[3], "*", "event", "removed", "jobId", repeatJobId, "prev", "delayed")
end
end
if(rcall("ZREM", KEYS[1], ARGV[3]) == 1) then
rcall("DEL", KEYS[1] .. ":" .. ARGV[3])
return 0
end
return 1