MCPcopy
hub / github.com/kubernetes/client-go / shouldResync

Method shouldResync

tools/cache/shared_informer.go:489–507  ·  view source on GitHub ↗

shouldResync queries every listener to determine if any of them need a resync, based on each listener's resyncPeriod.

()

Source from the content-addressed store, hash-verified

487// shouldResync queries every listener to determine if any of them need a resync, based on each
488// listener's resyncPeriod.
489func (p *sharedProcessor) shouldResync() bool {
490 p.listenersLock.Lock()
491 defer p.listenersLock.Unlock()
492
493 p.syncingListeners = []*processorListener{}
494
495 resyncNeeded := false
496 now := p.clock.Now()
497 for _, listener := range p.listeners {
498 // need to loop through all the listeners to see if they need to resync so we can prepare any
499 // listeners that are going to be resyncing.
500 if listener.shouldResync(now) {
501 resyncNeeded = true
502 p.syncingListeners = append(p.syncingListeners, listener)
503 listener.determineNextResync(now)
504 }
505 }
506 return resyncNeeded
507}
508
509func (p *sharedProcessor) resyncCheckPeriodChanged(resyncCheckPeriod time.Duration) {
510 p.listenersLock.RLock()

Callers

nothing calls this directly

Calls 2

determineNextResyncMethod · 0.80
NowMethod · 0.65

Tested by

no test coverage detected