4242]]
4343local rcall = redis .call
4444
45+ -- Includes
46+ --- @include "includes/removeLock"
47+ --- @include "includes/removeDebounceKeyIfNeeded"
48+ --- @include "includes/batches"
49+
4550--[[
4651 Functions to collect metrics based on a current and previous count of jobs.
4752 Granualarity is fixed at 1 minute.
@@ -68,7 +73,10 @@ local function collectMetrics(metaKey, dataPointsList, maxDataPoints, timestamp)
6873 local points = {}
6974 points [1 ] = delta
7075 for i = 2 , N do points [i ] = 0 end
71- rcall (" LPUSH" , dataPointsList , unpack (points ))
76+
77+ for from , to in batches (# points , 7000 ) do
78+ rcall (" LPUSH" , dataPointsList , unpack (points , from , to ))
79+ end
7280 else
7381 -- LPUSH delta to the list
7482 rcall (" LPUSH" , dataPointsList , delta )
@@ -82,10 +90,6 @@ local function collectMetrics(metaKey, dataPointsList, maxDataPoints, timestamp)
8290 end
8391end
8492
85- -- Includes
86- --- @include "includes/removeLock"
87- --- @include "includes/removeDebounceKeyIfNeeded"
88-
8993if rcall (" EXISTS" , KEYS [3 ]) == 1 then -- // Make sure job exists
9094 local errorCode = removeLock (KEYS [3 ], KEYS [8 ], ARGV [5 ], ARGV [1 ])
9195 if errorCode < 0 then
0 commit comments