Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exponential ¶
Exponential defines the strategy of having linearly increasing tick intervals.
func ExponentialJitter ¶
ExponentialJitter defines the strategy of having linearly increasing random tick intervals.
func LinearJitter ¶
LinearJitter defines the strategy of having random tick intervals.
func Tick ¶
func Tick(strategy IntervalStrategy) <-chan time.Time
Tick is a convenience wrapper for NewTicker providing access to the ticking channel only. While Tick is useful for clients that have no need to shut down the Ticker, be aware that without a way to shut it down the underlying Ticker cannot be recovered by the garbage collector; it "leaks".
Types ¶
type IntervalStrategy ¶
IntervalStrategy defines an interval strategy function.
type Ticker ¶
Ticker is similar to package time's Ticker but instead of choosing tick interval durations, tick interval strategies and maximum value are chosen.
func NewTicker ¶
func NewTicker(strategy IntervalStrategy) *Ticker
NewTicker returns a new Ticker containing a channel that will send the time in interval periods specified by an interval strategy. Stop the ticker to release associated resources.