mirror of
https://github.com/MedzikUser/go-pingbot
synced 2024-08-14 23:57:07 +00:00
28 lines
329 B
Go
28 lines
329 B
Go
package backend
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gitlab.com/gaming0skar123/go/pingbot/config"
|
|
)
|
|
|
|
func Ticker() {
|
|
// On Start
|
|
cache(0)
|
|
ping()
|
|
|
|
ticker := time.NewTicker(config.Toml.Backend.Ping * time.Minute)
|
|
|
|
quit := make(chan struct{})
|
|
|
|
for {
|
|
select {
|
|
case <-ticker.C:
|
|
ping()
|
|
case <-quit:
|
|
ticker.Stop()
|
|
|
|
return
|
|
}
|
|
}
|
|
}
|