From d9e7b3705d8b2b82af65134420e5cd0d7b559bca Mon Sep 17 00:00:00 2001 From: Em Sharnoff Date: Fri, 6 Oct 2023 16:16:03 -0700 Subject: [PATCH] agent/runner: Simplify getMetricsLoop --- pkg/agent/runner.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/pkg/agent/runner.go b/pkg/agent/runner.go index 3addb7166..e5dc26751 100644 --- a/pkg/agent/runner.go +++ b/pkg/agent/runner.go @@ -426,9 +426,6 @@ func (r *Runner) getMetricsLoop( timeout := time.Second * time.Duration(r.global.config.Metrics.RequestTimeoutSeconds) waitBetweenDuration := time.Second * time.Duration(r.global.config.Metrics.SecondsBetweenRequests) - // FIXME: make this configurable - minWaitDuration := time.Second - for { metrics, err := r.doMetricsRequest(ctx, logger, timeout) if err != nil { @@ -448,19 +445,10 @@ func (r *Runner) getMetricsLoop( }() next: - waitBetween := time.After(waitBetweenDuration) - minWait := time.After(minWaitDuration) - - select { - case <-ctx.Done(): - return - case <-minWait: - } - select { case <-ctx.Done(): return - case <-waitBetween: + case <-time.After(waitBetweenDuration): } } }