func()

in pkg/agent/agent.go [154:175]


func (a *Agent) periodicUpdateChecker(ctx context.Context) error {
	timer := time.NewTimer(initialPollDelay)
	defer timer.Stop()

	log := a.log.WithField("worker", "update-checker")

	for {
		select {
		case <-ctx.Done():
			log.Debug("finished")
			return nil
		case <-timer.C:
			log.Info("checking for update")
			err := a.checkPostUpdate(a.log)
			if err != nil {
				log.WithError(err).Error("update check failed")
			}
		}

		timer.Reset(updatePollInterval)
	}
}