From 57b73d8b49901ac1cd41f5909ff83b769d4af036 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Tue, 5 Jan 2021 16:06:36 +0800 Subject: [PATCH] make sure offset less than size even it's checked inside (#354) --- core/collection/rollingwindow.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/collection/rollingwindow.go b/core/collection/rollingwindow.go index 04ecf89e..2795195d 100644 --- a/core/collection/rollingwindow.go +++ b/core/collection/rollingwindow.go @@ -87,7 +87,7 @@ func (rw *RollingWindow) updateOffset() { offset := rw.offset // reset expired buckets for i := 0; i < span; i++ { - rw.win.resetBucket(offset + i + 1) + rw.win.resetBucket((offset + i + 1) % rw.size) } rw.offset = (offset + span) % rw.size