Documentation
¶
Overview ¶
Package retry provides some retry policies to call a function.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Retry ¶
type Retry interface {
// If f returns true or nil, it terminates retry.
Run(c context.Context, f func(context.Context) (success bool, err error)) error
}
Retry is an interface to retry the function until a condition reaches.
func NewPeriodicIntervalRetry ¶ added in v0.2.0
NewPeriodicIntervalRetry returns a new retry to call a runner function periodically until the context is done or it reaches the number.
number is the times to recall a function, which should be positive. If 0 or negative, it does nothing.
interval is the interval duration between two callings. If 0, it immediately retries to call.
Click to show internal directories.
Click to hide internal directories.