Merge pull request #256 from joeirimpan/fix/ticker

fix: Stop tickers
This commit is contained in:
Kailash Nadh 2021-01-28 21:16:08 +05:30 committed by GitHub
commit 101e92cbfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -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 {

View File

@ -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.