fixes issue #425 (#438)

This commit is contained in:
Kevin Wan
2021-02-05 13:32:56 +08:00
committed by GitHub
parent 7b3c3de35e
commit b88ba14597
6 changed files with 32 additions and 17 deletions

View File

@@ -21,6 +21,7 @@ func NewRing(n int) *Ring {
func (r *Ring) Add(v interface{}) {
r.lock.Lock()
defer r.lock.Unlock()
r.elements[r.index%len(r.elements)] = v
r.index++
}