Documentation
¶
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ticker ¶ added in v0.6.0
type Ticker struct { // Public copy of channel which receives time ticks. C <-chan time.Time // contains filtered or unexported fields }
Ticker extends logic of standard time.Ticker with backoff strategy. Each next time tick will increase by a specific backoff delay.
For implementation we using resource below. https://github.com/cenkalti/backoff/blob/v4.3.0/ticker.go.
func NewTicker ¶ added in v0.6.0
NewTicker creates new Ticker.
You can use it as time.Ticker. The structure provides a C channel for receiving time tick events.
Arguments:
backoff - structure for generating backoff duration. minDuration - the min duration of the next tick. In most cases this duration will be added to the generated backoff duration. factor - a random number that will be used to generate a random backoff duration. We will use numbers from 1 to 'factor' to generate a random backoff based on math/random/v2 functions.
Example:
func main() { // Like default time.Ticker() ticker := backoff.NewTicker(...) <-ticker.C }
Click to show internal directories.
Click to hide internal directories.