Description
The real implementation of ticker func looks like this:
func (t *realContextTicker) run() {
defer t.tkr.Stop()
for {
select {
case <-t.ctx.Done():
t.err <- t.ctx.Err()
return
case <-t.tkr.C:
err := t.f()
if err != nil {
t.err <- err
return
}
}
}
}
This means that only one call to t.f()
can occur at at time, no matter how long it takes. (The underlying ticker chan drops excess ticks.)
In contrast, the mock implementation will run t.f()
multiple times in parallel if you advance the clock across multiple ticks.