Descriptionutils: copy AttemptStrategy from goamz/aws.
The aws code, originally derived from the juju-core code,
allows for some neater ways of writing attempt-based code.
In particular it allows us to declare within the loop any variables retrieved
during the attempt.
for attempt := attempts.Start(); attempt.Next(); {
x, err := doSomething()
if shouldRetry(err) && attempt.HasNext() {
continue
}
if err != nil {
return err
}
doSomethingWith(x)
}
https://code.launchpad.net/~rogpeppe/juju-core/346-crossport-attempt/+merge/176241
(do not edit description out of merge proposal)
Patch Set 1 #Patch Set 2 : utils: copy AttemptStrategy from goamz/aws. #Patch Set 3 : utils: copy AttemptStrategy from goamz/aws. #
MessagesTotal messages: 5
|