From 2c4c6b05f0bdb2e5ebd3ed5c86b1ad55a45493ac Mon Sep 17 00:00:00 2001 From: Markus Thoemmes Date: Wed, 8 Aug 2018 19:36:47 +0200 Subject: [PATCH] Fix wrong variable reference. --- cmd/activator/main.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/activator/main.go b/cmd/activator/main.go index 44220053f083..e55a2c66a7b8 100644 --- a/cmd/activator/main.go +++ b/cmd/activator/main.go @@ -104,6 +104,14 @@ func (rrt *retryRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) break } + // stop retrying if the maximum elapsed time would be exceeded after + // the next timeout + nextDelay := rrt.CalculateDelay(retries, minRetryInterval) + elapsedTime := time.Now().Sub(startTime) + if elapsedTime+nextDelay > maxRetryTime { + break + } + if err != nil { rrt.logger.Errorf("Error making a request: %s", err) } @@ -112,14 +120,6 @@ func (rrt *retryRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) resp.Body.Close() } - // stop retrying if the maximum elapsed time would be exceeded after - // the next timeout - nextDelay := rrt.CalculateDelay(retries, minRetryInterval) - elapsedTime := time.Now().Sub(startTime) - if elapsedTime+maxRetryTime > maxRetryTime { - break - } - time.Sleep(nextDelay) // The request body cannot be read multiple times for retries.