runtime

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 4 Imported by: 0

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

type FunctionRetry struct {
	Ticker *time.Ticker
	// contains filtered or unexported fields
}

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL