Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTicker ¶ added in v1.6.0
NewTicker returns a channel that emits ticks starting immediately and then roughly every `interval` thereafter.
Design goals:
- Single goroutine, single time.Timer (no busy waits, no extra deps).
- Coalescing semantics: if the consumer is slow, ticks do NOT accumulate. The channel is buffered with size 1; sending is non-blocking.
- Monotonic scheduling: next tick time is advanced by fixed `interval` from the *ideal* schedule (next += interval), preserving cadence and avoiding bursts if we ever fall behind.
- Cancellation via ctx.Done().
- If interval <= 0, falls back to 1s.
First tick is sent immediately (best for “kick off then repeat” workflows).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.