Package list golang-github-go-kit-kit / db17f74
retry no longer waits after last error JP Robinson 5 years ago
1 changed file(s) with 8 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
190190 // set the system up to perform a retry loop
191191 var err error
192192 wait := RetryWait
193 for i := 1; i <= RetryMax; i++ {
193 for attempts := 1; ; attempts++ {
194194 err = e.flush(e.conn)
195 // no error? return immediately.
195196 if err == nil {
196197 return nil
197198 }
199 // we're at our last attempt? give up.
200 if attempts >= RetryMax {
201 break
202 }
203 // log, wait, and try again
198204 e.logger.Log(
199205 "err", err,
200 "msg", fmt.Sprintf("unable to flush metrics on attempt %d, waiting %s", i, wait),
206 "msg", fmt.Sprintf("unable to flush metrics on attempt %d, waiting %s", attempts, wait),
201207 )
202208 time.Sleep(wait)
203209 wait = wait * time.Duration(RetryMultiplier)