16 lines
409 B
Lua
16 lines
409 B
Lua
--[[
|
|
Functions to remove jobs by max count.
|
|
]]
|
|
|
|
-- Includes
|
|
--- @include "removeJob"
|
|
|
|
local function removeJobsByMaxCount(maxCount, targetSet, prefix)
|
|
local start = maxCount
|
|
local jobIds = rcall("ZREVRANGE", targetSet, start, -1)
|
|
for i, jobId in ipairs(jobIds) do
|
|
removeJob(jobId, false, prefix, false --[[remove debounce key]])
|
|
end
|
|
rcall("ZREMRANGEBYRANK", targetSet, 0, -(maxCount + 1))
|
|
end
|