tick

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlignedTicker

type AlignedTicker struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

func NewFixedTimer

func NewFixedTimer(start time.Time, interval time.Duration) *AlignedTicker

func (*AlignedTicker) Stop

func (at *AlignedTicker) Stop()

Stop the AlignedTicker from generating any more ticks on its channel. Like time.Ticker.Stop() and time.Timer.Stop(), does not close the public channel, so that a read on the channel won't unblock.

type JitterTicker

type JitterTicker struct {
	C <-chan time.Time // The channel on which the ticks are delivered.
	// contains filtered or unexported fields
}

func NewJitterTicker

func NewJitterTicker(d time.Duration, windowStart uint, windowEnd uint) *JitterTicker

Creates a jittered ticker windowStart and windowEnd specify the jitter range relative to the d interval For example, with d=1000ms start=80 and end=120, the first tick will happen after a random delay between 800ms and 1200ms. Subsequent ticks will happen every 1000ms.

func (*JitterTicker) Stop

func (t *JitterTicker) Stop()

Stop turns off a ticker. After Stop, no more ticks will be sent. Stop does not close the channel, to prevent a read from the channel succeeding incorrectly.

Jump to

Keyboard shortcuts

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