Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithExponentialBackoff ¶
WithExponentialBackoff repeatedly invokes the function `fn` with exponentially growing/shrinking delay between the calls, until `fn` reports that it's done, or until it returns an error, or until a specified maximum number of retries. in the latter case a somewhat gRPC-specific Status with `DeadlineExceeded` error is returned.
see Backoff documentation of individual `opts` field definitions.
if opts.Delay is not positive - no delay will be introduced between fn() invocations. otherwise, the delay will be bounded by opts.DelayLimit, if the latter is specified.
if opts.Factor is not positive - the delay introduced will be constant, i.e. effective factor of 1.0. if 0 < opts.Factor < 1, the delay introduced will be shrinking, otherwise it'll be growing.
if opts.DelayLimit is not positive - the delay will be increased/decreased by the specified factor on every step. otherwise, the delay between steps will be modified by the specified factor up/down to the delay limit.
if opts.Retries is not positive - `fn` will not be invoked at all.