Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loop ¶
type Loop struct {
// contains filtered or unexported fields
}
func (*Loop) Do ¶
func (l *Loop) Do(tf TaskFunc, opts ...TaskOptions)
func (*Loop) DoAndWait ¶
func (l *Loop) DoAndWait(tf TaskFunc, opts ...TaskOptions) (interface{}, error)
func (*Loop) Repeat ¶
func (l *Loop) Repeat(tf TaskFunc, opts ...TaskOptions)
type RepeatIntervalFunc ¶
RepeatIntervalFunc is used when schedule repeated TaskFunc. it takes result and error of previous TaskFunc invocation and determine the delay of next TaskFunc invocation
type TaskOption ¶
type TaskOption struct {
RepeatIntervalFunc RepeatIntervalFunc
}
type TaskOptions ¶
type TaskOptions func(opt *TaskOption)
func ExponentialRepeatIntervalOnError ¶
func ExponentialRepeatIntervalOnError(init time.Duration, factor float64) TaskOptions
ExponentialRepeatIntervalOnError returns a TaskOptions which set repeat interval to be exponentially increased if error is not nil. the repeat interval is reset to "init" if error is nil
func FixedRepeatInterval ¶
func FixedRepeatInterval(interval time.Duration) TaskOptions
FixedRepeatInterval returns a TaskOptions which set repeat interval to be fixed duration
Click to show internal directories.
Click to hide internal directories.