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

Method resyncChan

tools/cache/reflector.go:144–154  ·  view source on GitHub ↗

resyncChan returns a channel which will receive something when a resync is required, and a cleanup function.

()

Source from the content-addressed store, hash-verified

142// resyncChan returns a channel which will receive something when a resync is
143// required, and a cleanup function.
144func (r *Reflector) resyncChan() (<-chan time.Time, func() bool) {
145 if r.resyncPeriod == 0 {
146 return neverExitWatch, func() bool { return false }
147 }
148 // The cleanup function is required: imagine the scenario where watches
149 // always fail so we end up listing frequently. Then, if we don't
150 // manually stop the timer, we could end up with many timers active
151 // concurrently.
152 t := r.clock.NewTimer(r.resyncPeriod)
153 return t.C(), t.Stop
154}
155
156// ListAndWatch first lists all items and get the resource version at the moment of call,
157// and then use the resource version to watch.

Callers 3

TestReflectorResyncChanFunction · 0.95
ListAndWatchMethod · 0.95

Calls

no outgoing calls

Tested by 2

TestReflectorResyncChanFunction · 0.76