Skip to content

Commit

Permalink
Fix wrong variable reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
markusthoemmes committed Aug 8, 2018
1 parent ddc46b6 commit 2c4c6b0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/activator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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.
Expand Down

0 comments on commit 2c4c6b0

Please sign in to comment.