diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-02-01 12:23:56 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-02-02 11:26:24 +1100 |
commit | df050472a1330dbaed8e4e85571db3300143f827 (patch) | |
tree | 92b8fa522bf302736324e9119efbd4717c137086 /pkg/gui/gui.go | |
parent | c173ebf5b9b4c691e176ba8956aabada7b1b3562 (diff) |
more ticker improvements
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index c419f5dc9..d735b8418 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -788,9 +788,11 @@ func (gui *Gui) renderGlobalOptions() error { func (gui *Gui) goEvery(interval time.Duration, stop chan struct{}, function func() error) { go func() { + ticker := time.NewTicker(interval) + defer ticker.Stop() for { select { - case <-time.Tick(interval): + case <-ticker.C: _ = function() case <-stop: return |