From 8867f771d45ef0a786f1521c122a6d569c66a87a Mon Sep 17 00:00:00 2001 From: Joe Paul Date: Wed, 27 Jan 2021 12:55:53 +0530 Subject: [PATCH] fix: Stop tickers --- cmd/updates.go | 2 ++ internal/manager/manager.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cmd/updates.go b/cmd/updates.go index 09141b4..73f327d 100644 --- a/cmd/updates.go +++ b/cmd/updates.go @@ -34,6 +34,8 @@ func checkUpdates(curVersion string, interval time.Duration, app *App) { curVersion = reSemver.ReplaceAllString(curVersion, "") time.Sleep(time.Second * 1) ticker := time.NewTicker(interval) + defer ticker.Stop() + for ; true; <-ticker.C { resp, err := http.Get(updateCheckURL) if err != nil { diff --git a/internal/manager/manager.go b/internal/manager/manager.go index bf9b522..d4075ab 100644 --- a/internal/manager/manager.go +++ b/internal/manager/manager.go @@ -348,6 +348,8 @@ func (m *Manager) Close() { // for campaigns to process and dispatches them to the manager. func (m *Manager) scanCampaigns(tick time.Duration) { t := time.NewTicker(tick) + defer t.Stop() + for { select { // Periodically scan the data source for campaigns to process.