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

Method starting

pkg/compactor/blocks_cleaner.go:213–229  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

211}
212
213func (c *BlocksCleaner) starting(ctx context.Context) error {
214 // Run a cleanup so that any other service depending on this service
215 // is guaranteed to start once the initial cleanup has been done.
216 activeUsers, deletedUsers, err := c.scanUsers(ctx)
217
218 if err != nil {
219 level.Error(c.logger).Log("msg", "failed to scan users on startup", "err", err.Error())
220 c.runsFailed.WithLabelValues(deletedStatus).Inc()
221 c.runsFailed.WithLabelValues(activeStatus).Inc()
222 return nil
223 }
224 err = c.cleanUpActiveUsers(ctx, activeUsers, true)
225 c.checkRunError(activeStatus, err)
226 err = c.cleanDeletedUsers(ctx, deletedUsers)
227 c.checkRunError(deletedStatus, err)
228 return nil
229}
230
231func (c *BlocksCleaner) loop(ctx context.Context) error {
232 t := time.NewTicker(c.cfg.CleanupInterval)

Callers

nothing calls this directly

Calls 7

scanUsersMethod · 0.95
cleanUpActiveUsersMethod · 0.95
checkRunErrorMethod · 0.95
cleanDeletedUsersMethod · 0.95
LogMethod · 0.45
ErrorMethod · 0.45
IncMethod · 0.45

Tested by

no test coverage detected