go-pingbot/update/ticker.go

29 lines
333 B
Go
Raw Normal View History

2021-07-11 21:19:37 +00:00
package update
import (
"time"
"gitlab.com/gaming0skar123/go/pingbot/config"
)
func Ticker() {
2021-07-11 21:19:37 +00:00
// Check on start
2021-07-14 11:23:30 +00:00
Update()
2021-07-11 21:19:37 +00:00
2021-07-29 18:51:15 +00:00
ticker := time.NewTicker(config.Toml.AutoUpdate.Check * time.Minute)
2021-07-11 21:19:37 +00:00
quit := make(chan struct{})
for {
select {
case <-ticker.C:
2021-07-14 11:23:30 +00:00
Update()
2021-07-11 21:19:37 +00:00
case <-quit:
ticker.Stop()
return
}
}
}