go-pingbot/backend/run.go

24 lines
231 B
Go
Raw Normal View History

2021-07-11 21:19:37 +00:00
package backend
import (
"time"
)
func Run() {
ping()
ticker := time.NewTicker(2 * time.Minute)
quit := make(chan struct{})
for {
select {
case <-ticker.C:
ping()
case <-quit:
ticker.Stop()
return
}
}
}