2018-09-26 22:03:06 -04:00
|
|
|
package static
|
2018-09-18 16:42:38 -04:00
|
|
|
|
|
|
|
|
import "github.com/sethgrid/pester"
|
|
|
|
|
|
|
|
|
|
type (
|
|
|
|
|
Option func(opts *pester.Client)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func WithDefaultBackoff() Option {
|
|
|
|
|
return func(opts *pester.Client) {
|
|
|
|
|
opts.Backoff = pester.DefaultBackoff
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func WithLinearBackoff() Option {
|
|
|
|
|
return func(opts *pester.Client) {
|
|
|
|
|
opts.Backoff = pester.LinearBackoff
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func WithExponentialBackoff() Option {
|
|
|
|
|
return func(opts *pester.Client) {
|
|
|
|
|
opts.Backoff = pester.ExponentialBackoff
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func WithMaxRetries(value int) Option {
|
|
|
|
|
return func(opts *pester.Client) {
|
|
|
|
|
opts.MaxRetries = value
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func WithConcurrency(value int) Option {
|
|
|
|
|
return func(opts *pester.Client) {
|
|
|
|
|
opts.Concurrency = value
|
|
|
|
|
}
|
|
|
|
|
}
|