mirror of
https://github.com/OptimalBits/bull.git
synced 2026-07-02 00:17:41 +08:00
fix(metrics): differentiate points in different minutes to be more accurate (#2770)
This commit is contained in:
@@ -19,7 +19,7 @@ local function collectMetrics(metaKey, dataPointsList, maxDataPoints, timestamp)
|
||||
return
|
||||
end
|
||||
|
||||
local N = math.min(math.floor((timestamp - prevTS) / 60000), tonumber(maxDataPoints))
|
||||
local N = math.min(math.floor(timestamp / 60000) - math.floor(prevTS / 60000), tonumber(maxDataPoints))
|
||||
|
||||
if N > 0 then
|
||||
local delta = count - rcall("HGET", metaKey, "prevCount")
|
||||
|
||||
@@ -34,6 +34,8 @@ describe('metrics', () => {
|
||||
ONE_MINUTE,
|
||||
ONE_MINUTE,
|
||||
ONE_MINUTE * 3,
|
||||
ONE_SECOND * 70,
|
||||
ONE_SECOND * 50,
|
||||
ONE_HOUR,
|
||||
ONE_MINUTE
|
||||
];
|
||||
@@ -100,6 +102,8 @@ describe('metrics', () => {
|
||||
'0',
|
||||
'0',
|
||||
'1',
|
||||
'1',
|
||||
'1',
|
||||
'0',
|
||||
'0',
|
||||
'1',
|
||||
|
||||
Reference in New Issue
Block a user