-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
Hi there!
There is a known time.Ticker behavior when ticks are being dropped if user can't read from time.Ticker.C channel in time.
For some kind of "real-time" applications it may be useful to know that ticks are dropped to react somehow on such events.
I suppose it could be allowed just by extending time.Ticker struct with an optional exported callback field (and little tweaks of time.sendTime use):
const interval = time.Second
t := time.NewTicker(interval)
t.OnTickDrop = func() {
log.Printf("warning: dropping %s tick", interval)
}Without such feature users need to implement their own tick scheduler with very similar implementation to time's internals.
serejkus and OneOfOnempx and tmthrgdcristaloleg