MCPcopy
hub / github.com/grafana/dskit / Next

Method Next

grpcutil/dns_resolver.go:254–268  ·  view source on GitHub ↗

Next returns the resolved address update(delta) for the target. If there's no change, it will sleep for 30 mins and try to resolve again after that.

()

Source from the content-addressed store, hash-verified

252// Next returns the resolved address update(delta) for the target. If there's no
253// change, it will sleep for 30 mins and try to resolve again after that.
254func (w *dnsWatcher) Next() ([]*Update, error) {
255 for {
256 select {
257 case <-w.ctx.Done():
258 return nil, errWatcherClose
259 case <-w.t.C:
260 }
261 result := w.lookup()
262 // Next lookup should happen after an interval defined by w.r.freq.
263 w.t.Reset(w.r.freq)
264 if len(result) > 0 {
265 return result, nil
266 }
267 }
268}
269
270func (w *dnsWatcher) Close() {
271 w.cancel()

Callers

nothing calls this directly

Calls 3

lookupMethod · 0.95
DoneMethod · 0.65
ResetMethod · 0.45

Tested by

no test coverage detected