diff --git a/index.d.ts b/index.d.ts index f183ac79e..1cb0ad349 100644 --- a/index.d.ts +++ b/index.d.ts @@ -428,7 +428,23 @@ declare namespace Bull { every: number; } + interface DebounceOptions { + /** + * ttl in milliseconds + */ + ttl?: number; + /** + * Identifier + */ + id: string; + } + interface JobOptions { + /** + * Debounce options. + */ + debounce?: DebounceOptions; + /** * Optional priority value. ranges from 1 (highest priority) to MAX_INT (lowest priority). * Note that using priorities has a slight impact on performance, so do not use it if not required diff --git a/lib/commands/moveToFinished-9.lua b/lib/commands/moveToFinished-9.lua index 3c1e2f55d..1d69f94a1 100644 --- a/lib/commands/moveToFinished-9.lua +++ b/lib/commands/moveToFinished-9.lua @@ -42,6 +42,11 @@ ]] local rcall = redis.call +-- Includes +--- @include "includes/removeLock" +--- @include "includes/removeDebounceKeyIfNeeded" +--- @include "includes/batches" + --[[ Functions to collect metrics based on a current and previous count of jobs. Granualarity is fixed at 1 minute. @@ -68,7 +73,10 @@ local function collectMetrics(metaKey, dataPointsList, maxDataPoints, timestamp) local points = {} points[1] = delta for i = 2, N do points[i] = 0 end - rcall("LPUSH", dataPointsList, unpack(points)) + + for from, to in batches(#points, 7000) do + rcall("LPUSH", dataPointsList, unpack(points, from, to)) + end else -- LPUSH delta to the list rcall("LPUSH", dataPointsList, delta) @@ -82,10 +90,6 @@ local function collectMetrics(metaKey, dataPointsList, maxDataPoints, timestamp) end end --- Includes ---- @include "includes/removeLock" ---- @include "includes/removeDebounceKeyIfNeeded" - if rcall("EXISTS", KEYS[3]) == 1 then -- // Make sure job exists local errorCode = removeLock(KEYS[3], KEYS[8], ARGV[5], ARGV[1]) if errorCode < 0 then