reset ticker on directory change
This commit is contained in:
parent
bd63efeeb7
commit
8988cab87d
|
@ -11,7 +11,8 @@ import (
|
||||||
|
|
||||||
func slideshow(ch <-chan string) {
|
func slideshow(ch <-chan string) {
|
||||||
dir := <-ch
|
dir := <-ch
|
||||||
ticker := time.NewTicker(time.Duration(config.Duration) * time.Minute)
|
duration := time.Duration(config.Duration) * time.Minute
|
||||||
|
ticker := time.NewTicker(duration)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
@ -23,6 +24,7 @@ func slideshow(ch <-chan string) {
|
||||||
select {
|
select {
|
||||||
case dir = <-ch:
|
case dir = <-ch:
|
||||||
log.Println("directory set!")
|
log.Println("directory set!")
|
||||||
|
ticker.Reset(duration)
|
||||||
continue
|
continue
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue