build: upgrade to go 1.17 and dependencies
This commit is contained in:
37
vendor/github.com/avast/retry-go/README.md
generated
vendored
37
vendor/github.com/avast/retry-go/README.md
generated
vendored
@ -64,6 +64,12 @@ nonintuitive interface (for me)
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
3.0.0
|
||||
|
||||
* `DelayTypeFunc` accepts a new parameter `err` - this breaking change affects
|
||||
only your custom Delay Functions. This change allow [make delay functions based
|
||||
on error](examples/delay_based_on_error_test.go).
|
||||
|
||||
1.0.2 -> 2.0.0
|
||||
|
||||
* argument of `retry.Delay` is final delay (no multiplication by `retry.Units`
|
||||
@ -91,13 +97,14 @@ var (
|
||||
DefaultRetryIf = IsRecoverable
|
||||
DefaultDelayType = CombineDelay(BackOffDelay, RandomDelay)
|
||||
DefaultLastErrorOnly = false
|
||||
DefaultContext = context.Background()
|
||||
)
|
||||
```
|
||||
|
||||
#### func BackOffDelay
|
||||
|
||||
```go
|
||||
func BackOffDelay(n uint, config *Config) time.Duration
|
||||
func BackOffDelay(n uint, _ error, config *Config) time.Duration
|
||||
```
|
||||
BackOffDelay is a DelayType which increases delay between consecutive retries
|
||||
|
||||
@ -110,7 +117,7 @@ func Do(retryableFunc RetryableFunc, opts ...Option) error
|
||||
#### func FixedDelay
|
||||
|
||||
```go
|
||||
func FixedDelay(_ uint, config *Config) time.Duration
|
||||
func FixedDelay(_ uint, _ error, config *Config) time.Duration
|
||||
```
|
||||
FixedDelay is a DelayType which keeps delay the same through all iterations
|
||||
|
||||
@ -124,7 +131,7 @@ IsRecoverable checks if error is an instance of `unrecoverableError`
|
||||
#### func RandomDelay
|
||||
|
||||
```go
|
||||
func RandomDelay(_ uint, config *Config) time.Duration
|
||||
func RandomDelay(_ uint, _ error, config *Config) time.Duration
|
||||
```
|
||||
RandomDelay is a DelayType which picks a random delay up to config.maxJitter
|
||||
|
||||
@ -146,9 +153,11 @@ type Config struct {
|
||||
#### type DelayTypeFunc
|
||||
|
||||
```go
|
||||
type DelayTypeFunc func(n uint, config *Config) time.Duration
|
||||
type DelayTypeFunc func(n uint, err error, config *Config) time.Duration
|
||||
```
|
||||
|
||||
DelayTypeFunc is called to return the next delay to wait after the retriable
|
||||
function fails on `err` after `n` attempts.
|
||||
|
||||
#### func CombineDelay
|
||||
|
||||
@ -207,6 +216,26 @@ func Attempts(attempts uint) Option
|
||||
```
|
||||
Attempts set count of retry default is 10
|
||||
|
||||
#### func Context
|
||||
|
||||
```go
|
||||
func Context(ctx context.Context) Option
|
||||
```
|
||||
Context allow to set context of retry default are Background context
|
||||
|
||||
example of immediately cancellation (maybe it isn't the best example, but it
|
||||
describes behavior enough; I hope)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
retry.Do(
|
||||
func() error {
|
||||
...
|
||||
},
|
||||
retry.Context(ctx),
|
||||
)
|
||||
|
||||
#### func Delay
|
||||
|
||||
```go
|
||||
|
Reference in New Issue
Block a user