Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExponentialBackoffWithContext ¶
func ExponentialBackoffWithContext(ctx context.Context, backoff wait.Backoff, condition ConditionWithContextFunc) error
ExponentialBackoffWithContext repeats a condition check with exponential backoff and stop repeating when the context passed to this function is done.
It checks the condition up to Steps times, increasing the wait by multiplying the previous duration by Factor.
If Jitter is greater than zero, a random amount of each duration is added (between duration and duration*(1+jitter)).
If the condition never returns true, ErrWaitTimeout is returned. All other errors terminate immediately.
func IsHTTPClientError ¶
IsHTTPClientError indicates whether the error passes is an 4xx API server error (client error).
func RetryOnConnectionErrors ¶
func RetryOnConnectionErrors(ctx context.Context, fn ConditionWithContextFunc) error
RetryOnConnectionErrors will take context and condition function and retry the condition function until: 1) no error is returned 2) a client (4xx) HTTP error is returned 3) the context passed to the condition function is done 4) numbers of steps in the exponential backoff are met In case of 3) or 4) the error returned will be the last observed error from the condition function.
Types ¶
type ConditionWithContextFunc ¶
ConditionWithContextFunc returns true if the condition is satisfied, or an error if the loop should be aborted. The context passed to condition function allow function body to return faster than context.Done().