make sure offset less than size even it's checked inside (#354)

master v1.1.2
Kevin Wan 4 years ago committed by GitHub
parent a79cee12ee
commit 57b73d8b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save