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

Method loop

runtimeconfig/manager.go:177–199  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

175}
176
177func (om *Manager) loop(ctx context.Context) error {
178 if len(om.cfg.LoadPath) == 0 {
179 level.Info(om.logger).Log("msg", "runtime config disabled: file not specified")
180 <-ctx.Done()
181 return nil
182 }
183
184 ticker := time.NewTicker(om.cfg.ReloadPeriod)
185 defer ticker.Stop()
186
187 for {
188 select {
189 case <-ticker.C:
190 err := om.loadConfig(ctx)
191 if err != nil {
192 // Log but don't stop on error - we don't want to halt all ingesters because of a typo
193 level.Error(om.logger).Log("msg", "failed to load config", "err", err)
194 }
195 case <-ctx.Done():
196 return nil
197 }
198 }
199}
200
201// loadConfig loads all configuration files using the loader function then merges the yaml configuration files into one yaml document.
202// and notifies listeners if successful.

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected