MCPcopy Create free account
hub / github.com/cortexproject/cortex / loop

Method loop

pkg/ring/ring.go:304–320  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

302}
303
304func (r *Ring) loop(ctx context.Context) error {
305 // Update the ring metrics at start of the main loop.
306 r.mtx.Lock()
307 r.updateRingMetrics(Different)
308 r.mtx.Unlock()
309
310 r.KVClient.WatchKey(ctx, r.key, func(value any) bool {
311 if value == nil {
312 level.Info(r.logger).Log("msg", "ring doesn't exist in KV store yet")
313 return true
314 }
315
316 r.updateRingState(value.(*Desc))
317 return true
318 })
319 return nil
320}
321
322func (r *Ring) updateRingState(ringDesc *Desc) {
323 r.mtx.RLock()

Callers

nothing calls this directly

Calls 4

updateRingMetricsMethod · 0.95
updateRingStateMethod · 0.95
WatchKeyMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected