(ctx context.Context)
| 302 | } |
| 303 | |
| 304 | func (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 | |
| 322 | func (r *Ring) updateRingState(ringDesc *Desc) { |
| 323 | r.mtx.RLock() |
nothing calls this directly
no test coverage detected