small refactor

This commit is contained in:
yusing 2025-02-13 18:52:00 +08:00
parent 10d23828a7
commit 41d37579dc

View file

@ -26,10 +26,7 @@ func (e *Entries[T]) Add(now time.Time, info *T) {
return return
} }
e.entries[e.index] = info e.entries[e.index] = info
e.index++ e.index = (e.index + 1) % maxEntries
if e.index >= maxEntries {
e.index = 0
}
if e.count < maxEntries { if e.count < maxEntries {
e.count++ e.count++
} }