From 8988cab87dba52c6fab3fb537cebf0bc0721905b Mon Sep 17 00:00:00 2001 From: andrzej Date: Mon, 4 Nov 2024 21:28:55 +0100 Subject: [PATCH] reset ticker on directory change --- slideshow.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/slideshow.go b/slideshow.go index 4a65764..15d2718 100644 --- a/slideshow.go +++ b/slideshow.go @@ -11,7 +11,8 @@ import ( func slideshow(ch <-chan string) { dir := <-ch - ticker := time.NewTicker(time.Duration(config.Duration) * time.Minute) + duration := time.Duration(config.Duration) * time.Minute + ticker := time.NewTicker(duration) go func() { for { @@ -23,6 +24,7 @@ func slideshow(ch <-chan string) { select { case dir = <-ch: log.Println("directory set!") + ticker.Reset(duration) continue case <-ticker.C: continue