From 58d1eef50218ce25a6437ec20b3a4730a24eb9ec Mon Sep 17 00:00:00 2001 From: CallanTaylor Date: Tue, 19 Nov 2019 15:14:49 +1300 Subject: [PATCH] Defer stop ticker --- pkg/tasks/tasks.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/tasks/tasks.go b/pkg/tasks/tasks.go index fec20990..e028dbd4 100644 --- a/pkg/tasks/tasks.go +++ b/pkg/tasks/tasks.go @@ -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 {