mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
0eff83cb9d
* Use a cache of one entry to build attestation * Gazelle * Enforce on RPC side * Rm unused var * Potuz feedback, dont use pointer * Fix tests * Init fetcher * Add in-progress * Add back missing lock * Potuz feedback * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> --------- Co-authored-by: Potuz <potuz@prysmaticlabs.com>
23 lines
520 B
Go
23 lines
520 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{}) error {
|
|
return nil
|
|
}
|