From bed494d904718f3fe7d94d82fdf43ffdcc618d73 Mon Sep 17 00:00:00 2001 From: xuezonggui <34224965+TonoT@users.noreply.github.com> Date: Sat, 28 Nov 2020 19:43:39 +0800 Subject: [PATCH] optimization (#221) --- core/collection/rollingwindow.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/collection/rollingwindow.go b/core/collection/rollingwindow.go index 149d88b4..9f0db0a5 100644 --- a/core/collection/rollingwindow.go +++ b/core/collection/rollingwindow.go @@ -79,6 +79,7 @@ func (rw *RollingWindow) updateOffset() { // reset expired buckets start := offset + 1 steps := start + span + offset = (offset + span) % rw.size var remainder int if steps > rw.size { remainder = steps - rw.size @@ -86,11 +87,9 @@ func (rw *RollingWindow) updateOffset() { } for i := start; i < steps; i++ { rw.win.resetBucket(i) - offset = i } for i := 0; i < remainder; i++ { rw.win.resetBucket(i) - offset = i } rw.offset = offset rw.lastTime = timex.Now()