Skip to content

Commit

Permalink
fix fail-on-success-after-retry scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Mornini committed Feb 15, 2018
1 parent 812728d commit a466057
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions 07-desired-request-sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,26 @@ func desiredRequestSender(context *context) {

context.SpecTriplet.StartedAt = time.Now()

for attempt := 1; attempt <= context.MaxHTTPAttempts; attempt++ {
attempt := 0

for {
context.HTTPResponse, err = context.HTTPClient.Do(request)

if errorHandler(context, err) {
if attempt < context.MaxHTTPAttempts {
time.Sleep(context.HTTPRetryDelay)
attempt++

if err == nil {
break
}

continue
}
if attempt >= context.MaxHTTPAttempts {
context.Err = err

return
}

break
time.Sleep(context.HTTPRetryDelay)

continue
}

actualResponseReceiver(context)
Expand Down

0 comments on commit a466057

Please sign in to comment.