Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultSleep = 1 * time.Second ReadableDefaultSleep = "1s" )
Functions ¶
func Do ¶
Do runs the passed function until the number of retries is reached. Whenever Func returns err it will sleep and Func will be executed again in a recursive fashion. The sleep value is slightly modified on every retry (exponential backoff) to prevent the thundering herd problem (https://en.wikipedia.org/wiki/Thundering_herd_problem). If no value is given to sleep it will defaults to 500ms.
func DoCondition ¶
func DoCondition(fn ConditionFunc, retries int, sleep time.Duration) error
Types ¶
type ConditionFunc ¶
ConditionFunc returns additional flag determine whether to break retry or not.
Click to show internal directories.
Click to hide internal directories.