Skip to content

Commit

Permalink
fix: Stop tickers
Browse files Browse the repository at this point in the history
  • Loading branch information
joeirimpan authored and Joe Paul committed Jan 27, 2021
1 parent 6f2f361 commit 8867f77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions internal/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8867f77

Please sign in to comment.