Documentation
¶
Index ¶
- Variables
- func Retry(num int, fn func(i int)) (err error)
- func RetryAt(t time.Duration, fn func(i int))
- func Ticker(fn func(i int) time.Duration)
- func Try(fn interface{}) func(...interface{}) func(...interface{}) (err error)
- func TryRaw(fn reflect.Value) func(...reflect.Value) func(...reflect.Value) (err error)
- type Retry
- func (r *Retry) Attempt(attempt int) dataflow.Retry
- func (r *Retry) Do() (err error)
- func (r *Retry) Func(cb func(c *dataflow.Context) error) dataflow.Retry
- func (r *Retry) MaxWaitTime(maxWaitTime time.Duration) dataflow.Retry
- func (r *Retry) New(df *dataflow.DataFlow) interface{}
- func (r *Retry) WaitTime(waitTime time.Duration) dataflow.Retry
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrGotry = xerror.NewXErr("Gotry") ErrNotFuncType = ErrGotry.New("func type not match error") ErrParamsNotMatch = ErrGotry.New("params not match error") ErrRetry = ErrGotry.New("retry error") )
View Source
var ( // RetryWaitTime retry basic wait time RetryWaitTime = 200 * time.Millisecond // RetryMaxWaitTime Maximum retry wait time RetryMaxWaitTime = 10 * time.Second // RetryAttempt number of retries RetryAttempt = 1 )
View Source
var ( ErrRetryFail = errors.New("retry fail") ErrRetry = errors.New("need to retry") )
View Source
var IsDebug = xenv.IsDebug()
Functions ¶
Types ¶
type Retry ¶
type Retry struct {
// contains filtered or unexported fields
}
Retry is the core data structure of the retry function https://amazonaws-china.com/cn/blogs/architecture/exponential-backoff-and-jitter/
func (*Retry) MaxWaitTime ¶ added in v0.2.45
MaxWaitTime Sets the maximum wait time
Click to show internal directories.
Click to hide internal directories.