Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MaxRetries = 10
MaxRetries is the maximum number of retries before bailing.
Functions ¶
func Do ¶
Do keeps trying the function until the second argument returns false, or no error is returned, attempt is started at 1.
A *multierror.Error combining all attempt errors on failure. If the function does not return true before MaxRetries then the combination of all errors that occurred will be returned which IsMaxRetries() will return true for.
func IsMaxRetries ¶
IsMaxRetries checks whether the error is due to hitting the maximum number of retries or not.
func Limited ¶
Limited try to do fn in limit times and will sleep in (logarithmic) duration of unit (millisecond, second,etc) and not more than unit * maxSleep. The return channel stream's fn error in each iteration and can be use for blocking or/and if caller is interested
func WithCancel ¶
func WithCancel(ctx context.Context, unit time.Duration, maxSleep uint, fn func() error) <-chan error
WithCancel try to do fn until context will cancel or fn return nil and will sleep in (logarithmic) duration of unit (millisecond, second,etc) and not more than unit * maxSleep. The return channel stream's fn error in each iteration and can be use for blocking or/and if caller is interested