mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
* version bump on k8s io client-go and apimachinery * bazel file served * fixing build issues * some changes in noops functions * Update CHANGELOG.md --------- Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com> Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
23 lines
528 B
Go
23 lines
528 B
Go
package cache
|
|
|
|
import (
|
|
"k8s.io/client-go/tools/cache"
|
|
)
|
|
|
|
// trim the FIFO queue to the maxSize.
|
|
func trim(queue *cache.FIFO, maxSize uint64) {
|
|
for s := uint64(len(queue.ListKeys())); s > maxSize; s-- {
|
|
_, err := queue.Pop(popProcessNoopFunc)
|
|
if err != nil {
|
|
// popProcessNoopFunc never returns an error, but we handle this anyway to make linter
|
|
// happy.
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
// popProcessNoopFunc is a no-op function that never returns an error.
|
|
func popProcessNoopFunc(_ interface{}, _ bool) error {
|
|
return nil
|
|
}
|