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

Method loop

pkg/util/runtimeconfig/manager.go:142–164  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

140}
141
142func (om *Manager) loop(ctx context.Context) error {
143 if om.cfg.LoadPath == "" {
144 level.Info(om.logger).Log("msg", "runtime config disabled: file not specified")
145 <-ctx.Done()
146 return nil
147 }
148
149 ticker := time.NewTicker(om.cfg.ReloadPeriod)
150 defer ticker.Stop()
151
152 for {
153 select {
154 case <-ticker.C:
155 err := om.loadConfig(ctx)
156 if err != nil {
157 // Log but don't stop on error - we don't want to halt all ingesters because of a typo
158 level.Error(om.logger).Log("msg", "failed to load config", "err", err)
159 }
160 case <-ctx.Done():
161 return nil
162 }
163 }
164}
165
166// loadConfig loads configuration using the loader function, and if successful,
167// stores it as current configuration and notifies listeners.

Callers

nothing calls this directly

Calls 5

loadConfigMethod · 0.95
DoneMethod · 0.80
StopMethod · 0.65
LogMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected