Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UntilWithBackoff ¶
func UntilWithBackoff(ctx context.Context, f func(context.Context) SpeedSignal)
UntilWithBackoff runs f in a loop until context indicates finished. It applies backoff depending on the SpeedSignal f returns. Backoff increases exponentially, ranging from 1ms to 100ms.
Types ¶
type SpeedSignal ¶
type SpeedSignal bool
SpeedSignal indicates whether we should run the function again immediately, or apply backoff.
const ( // KeepGoing signals to continue immediately. KeepGoing SpeedSignal = true // SlowDown signals to backoff. SlowDown SpeedSignal = false )
Click to show internal directories.
Click to hide internal directories.