mirror of
https://github.com/OptimalBits/bull.git
synced 2026-07-02 08:27:43 +08:00
This commit is contained in:
Vendored
+16
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user