go-pingbot/backend/start.go

27 lines
305 B
Go
Raw Normal View History

2021-07-11 21:19:37 +00:00
package backend
import (
"time"
"gitlab.com/gaming0skar123/go/pingbot/config"
2021-07-11 21:19:37 +00:00
)
func Start() {
// Ping on Start
2021-07-11 21:19:37 +00:00
ping()
ticker := time.NewTicker(config.PingBot_Ticker)
2021-07-11 21:19:37 +00:00
quit := make(chan struct{})
for {
select {
case <-ticker.C:
ping()
case <-quit:
ticker.Stop()
return
}
}
}