Documentation ¶
Index ¶
- func ExecWithInterval(fn StoppableFunc, start, limit time.Duration)
- func ExecWithTimeout(ctx context.Context, logger *zap.Logger, fn Func, t time.Duration) (bool, interface{}, error)
- func NewExecutionQueue(interval time.Duration, opt ...ExecQueueOpt) queue.Queue
- func Retry(fn Fn, retries int) error
- func RetryWithContext(pctx context.Context, fn Fn, retries int) error
- type ExecQueueOpt
- type Fn
- type Func
- type StoppableFunc
- type Stopper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecWithInterval ¶ added in v0.0.4
func ExecWithInterval(fn StoppableFunc, start, limit time.Duration)
ExecWithInterval executes a function with a dynamic interval the interval is getting multiplied by 2 in each round, up to the given limit and then it starts all over 1s > 2s > 4s > 8s ... > 1s > 2s > ...
func ExecWithTimeout ¶
func ExecWithTimeout(ctx context.Context, logger *zap.Logger, fn Func, t time.Duration) (bool, interface{}, error)
ExecWithTimeout triggers some function in the given time frame, returns true if completed
func NewExecutionQueue ¶ added in v0.0.19
func NewExecutionQueue(interval time.Duration, opt ...ExecQueueOpt) queue.Queue
NewExecutionQueue creates a new instance
Types ¶
type ExecQueueOpt ¶ added in v0.2.0
type ExecQueueOpt func(*executionQueue)
ExecQueueOpt enables to inject more parameters
func WithoutErrors ¶ added in v0.2.0
func WithoutErrors() ExecQueueOpt
WithoutErrors disables errors
type StoppableFunc ¶ added in v0.0.4
StoppableFunc represents a function that returns two boolean to help with its execution stop will stop the interval, while continue will make the interval value to remain the same if both are false, the interval will be increased (x2)
Click to show internal directories.
Click to hide internal directories.