in storage/indexer.go [122:153]
func (i *Indexer) watchIndices(ctx context.Context) {
i.logger.Debug("Watch indices for changes")
if i.options.WatchInterval == 0 {
i.logger.Debug("No watcher configured, indices will not be updated (use only for testing purposes)")
return
}
var err error
t := time.NewTicker(i.options.WatchInterval)
defer t.Stop()
for {
i.logger.Debug("watchIndices: start")
func() {
tx := i.options.APMTracer.StartTransaction("updateIndex", "backend.watcher")
defer tx.End()
err = i.updateIndex(apm.ContextWithTransaction(ctx, tx))
if err != nil {
i.logger.Error("can't update index file", zap.Error(err))
}
}()
i.logger.Debug("watchIndices: finished")
select {
case <-ctx.Done():
i.logger.Debug("watchIndices: quit")
return
case <-t.C:
}
}
}