1010
1111Simple library for retry mechanism
1212
13- slightly inspired by
13+ Slightly inspired by
1414[ Try::Tiny::Retry] ( https://metacpan.org/pod/Try::Tiny::Retry )
1515
1616# SYNOPSIS
1717
18- http get with retry:
18+ HTTP GET with retry:
1919
2020 url := "http://example.com"
2121 var body []byte
@@ -31,17 +31,17 @@ http get with retry:
3131 if err != nil {
3232 return err
3333 }
34-
3534 return nil
3635 },
3736 )
37+
3838 if err != nil {
3939 // handle error
4040 }
4141
4242 fmt.Println(string(body))
4343
44- http get with retry with data:
44+ HTTP GET with retry with data:
4545
4646 url := "http://example.com"
4747
@@ -60,13 +60,14 @@ http get with retry with data:
6060 return body, nil
6161 },
6262 )
63+
6364 if err != nil {
6465 // handle error
6566 }
6667
6768 fmt.Println(string(body))
6869
69- [ next examples] ( https://github.com/avast/retry-go/tree/master/examples )
70+ [ More examples] ( https://github.com/avast/retry-go/tree/master/examples )
7071
7172# SEE ALSO
7273
@@ -241,10 +242,10 @@ used with that library.
241242#### type OnRetryFunc
242243
243244` ` ` go
244- type OnRetryFunc func(n uint, err error)
245+ type OnRetryFunc func(attempt uint, err error)
245246` ` `
246247
247- Function signature of OnRetry function n = count of attempts
248+ Function signature of OnRetry function
248249
249250#### type Option
250251
@@ -366,7 +367,7 @@ skip retry if special error example:
366367 return false
367368 }
368369 return true
369- }),
370+ })
370371 )
371372
372373By default RetryIf stops execution if the error is wrapped using
@@ -378,6 +379,14 @@ By default RetryIf stops execution if the error is wrapped using
378379 }
379380 )
380381
382+ #### func UntilSucceeded
383+
384+ ```go
385+ func UntilSucceeded() Option
386+ ```
387+ UntilSucceeded will retry until the retried function succeeds. Equivalent to
388+ setting Attempts(0).
389+
381390#### func WithTimer
382391
383392```go
0 commit comments