fix: initialize average cache state with cleared values
All checks were successful
Release Tag / release (push) Successful in 9s
All checks were successful
Release Tag / release (push) Successful in 9s
This commit is contained in:
@@ -14,11 +14,15 @@ type AvgCacheState struct {
|
|||||||
|
|
||||||
// New creates a new average cache state with the given size.
|
// New creates a new average cache state with the given size.
|
||||||
func New(size int) *AvgCacheState {
|
func New(size int) *AvgCacheState {
|
||||||
return &AvgCacheState{
|
a := &AvgCacheState{
|
||||||
size: size,
|
size: size,
|
||||||
avgs: make([]cachestate.CacheState, size),
|
avgs: make([]cachestate.CacheState, size),
|
||||||
mu: sync.Mutex{},
|
mu: sync.Mutex{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.Clear()
|
||||||
|
|
||||||
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear resets the average cache state to zero.
|
// Clear resets the average cache state to zero.
|
||||||
|
|||||||
Reference in New Issue
Block a user