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

Function WaitForCacheSync

tools/cache/shared_informer.go:160–178  ·  view source on GitHub ↗

WaitForCacheSync waits for caches to populate. It returns true if it was successful, false if the controller should shutdown

(stopCh <-chan struct{}, cacheSyncs ...InformerSynced)

Source from the content-addressed store, hash-verified

158// WaitForCacheSync waits for caches to populate. It returns true if it was successful, false
159// if the controller should shutdown
160func WaitForCacheSync(stopCh <-chan struct{}, cacheSyncs ...InformerSynced) bool {
161 err := wait.PollUntil(syncedPollPeriod,
162 func() (bool, error) {
163 for _, syncFunc := range cacheSyncs {
164 if !syncFunc() {
165 return false, nil
166 }
167 }
168 return true, nil
169 },
170 stopCh)
171 if err != nil {
172 klog.V(2).Infof("stop requested")
173 return false
174 }
175
176 klog.V(4).Infof("caches populated")
177 return true
178}
179
180type sharedIndexInformer struct {
181 indexer Indexer

Callers 5

UntilWithSyncFunction · 0.92
TestFakeClientFunction · 0.92
RunMethod · 0.92
WaitForCacheSyncMethod · 0.92
WaitForCacheSyncMethod · 0.92

Calls

no outgoing calls

Tested by 1

TestFakeClientFunction · 0.74