Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTickerDuration = time.Second * 10
Functions ¶
func IgnoreError ¶
func IgnoreError(err error)
accepts error and logs error message. Used to prevent warnings when errors not caught.
func IgnoreErrorMultiReturn ¶
func IgnoreErrorMultiReturn(i interface{}, err error)
func RemoveTicker ¶
func RemoveTicker(name string)
Types ¶
type FunctionRetry ¶
ResettableFunction will reset the user state as soon as tick is delivered.
func NewRetryTicker ¶
func NewRetryTicker(ctx context.Context, name string, option ...FunctionRetryOption) *FunctionRetry
func (*FunctionRetry) Do ¶
func (t *FunctionRetry) Do(f func(), cancel_f func(), deadline_f func())
type FunctionRetryOption ¶
type FunctionRetryOption func(*FunctionRetry)
func WithRetryDuration ¶
func WithRetryDuration(d time.Duration) FunctionRetryOption
type ResettableFunction ¶
type ResettableFunction struct {
Ticker *time.Ticker
Timer *time.Timer
ResetChan chan struct{} // channel used to reset the ticker
StopChan chan struct{} // channel used to reset the ticker
Started bool
// contains filtered or unexported fields
}
ResettableFunction will reset the user state as soon as tick is delivered.
func Get ¶
func Get(name string) (*ResettableFunction, bool)
func GetFunction ¶
func GetFunction(name string, option ...ResettableFunctionTickerOption) *ResettableFunction
func NewResettableFunction ¶
func NewResettableFunction(name string, option ...ResettableFunctionTickerOption) *ResettableFunction
func (*ResettableFunction) Do ¶
func (t *ResettableFunction) Do(functionCallback func())
Do will listen for timers and invoke functionCallback on tick.
type ResettableFunctionTickerOption ¶
type ResettableFunctionTickerOption func(*ResettableFunction)
func WithDuration ¶
func WithDuration(d time.Duration) ResettableFunctionTickerOption
func WithTicker ¶
func WithTicker(t *time.Ticker) ResettableFunctionTickerOption
func WithTimer ¶
func WithTimer(t *time.Timer) ResettableFunctionTickerOption
Click to show internal directories.
Click to hide internal directories.