Merge pull request #191 from CallanTaylor/stop-ticker

Defer stop ticker
This commit is contained in:
Dawid Dziurla 2019-11-19 10:29:10 +01:00 committed by GitHub
commit 14f27e86c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,6 +118,7 @@ func (t *TaskManager) NewTickerTask(duration time.Duration, before func(stop cha
before(stop)
}
tickChan := time.NewTicker(duration)
defer tickChan.Stop()
// calling f first so that we're not waiting for the first tick
f(stop, notifyStopped)
for {