Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSubTicker ¶ added in v1.1.0
NewSubTicker returns a channel that reads from another struct{}{} channel and then sends a `struct{}{}` at most `*maxrate` times per second, but that cannot exceed the parent tick rate.
If counter is not nil, it is incremented every time a send is successful.
Use this to make "background" tickers that are less prioritized.
The channel is closed when the parent channel is closed.
func NewTicker ¶
NewTicker returns a channel that sends a `struct{}{}` at most `*maxrate` times per second.
If counter is not nil, it is incremented every time a send is successful.
A nil `maxrate` or a `*maxrate` of zero or less sends as quickly as possible.
The channel is closed when the context is done.