Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ticker ¶
func NewTicker ¶
NewTicker creates a Ticker that works similar to time.Ticker, but sends the time with a period specified by `duration` adjusted by a pseudorandom jitter in the range of [duration-jitter, duration+jitter). Following the behavior of time.Ticker, we use a 1-buffer channel, so if the client falls behind while reading, we'll drop ticks on the floor until the client catches up. Callers have to make sure that both duration and the [d-j, d+j) intervals are valid positive int64 values (non-negative and non-overflowing). Use Stop to release associated resources and the Reset methods to modify the duration and jitter.
func (*Ticker) Reset ¶
Reset stops the Ticker, resets its base duration to the specified argument and re-calculates the period with a jitter. The next tick will arrive after the new period elapses.
func (*Ticker) ResetJitter ¶
Reset stops the Ticker, resets its jitter to the specified argument and re-calculates the period with the new jitter. The next tick will arrive after the new period elapses.