Browse Source

fix: Stop tickers

Joe Paul 4 years ago
parent
commit
8867f771d4
2 changed files with 4 additions and 0 deletions
  1. 2 0
      cmd/updates.go
  2. 2 0
      internal/manager/manager.go

+ 2 - 0
cmd/updates.go

@@ -34,6 +34,8 @@ func checkUpdates(curVersion string, interval time.Duration, app *App) {
 	curVersion = reSemver.ReplaceAllString(curVersion, "")
 	curVersion = reSemver.ReplaceAllString(curVersion, "")
 	time.Sleep(time.Second * 1)
 	time.Sleep(time.Second * 1)
 	ticker := time.NewTicker(interval)
 	ticker := time.NewTicker(interval)
+	defer ticker.Stop()
+
 	for ; true; <-ticker.C {
 	for ; true; <-ticker.C {
 		resp, err := http.Get(updateCheckURL)
 		resp, err := http.Get(updateCheckURL)
 		if err != nil {
 		if err != nil {

+ 2 - 0
internal/manager/manager.go

@@ -348,6 +348,8 @@ func (m *Manager) Close() {
 // for campaigns to process and dispatches them to the manager.
 // for campaigns to process and dispatches them to the manager.
 func (m *Manager) scanCampaigns(tick time.Duration) {
 func (m *Manager) scanCampaigns(tick time.Duration) {
 	t := time.NewTicker(tick)
 	t := time.NewTicker(tick)
+	defer t.Stop()
+
 	for {
 	for {
 		select {
 		select {
 		// Periodically scan the data source for campaigns to process.
 		// Periodically scan the data source for campaigns to process.