mirror of
https://github.com/status-im/status-go-monitor.git
synced 2025-01-13 04:44:10 +00:00
20 lines
312 B
Go
20 lines
312 B
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
func FetchLoop(state *State, interval int) {
|
|
// Get the first peers fetch going sooner
|
|
state.Fetch()
|
|
// Then fetch every `interval` seconds
|
|
for {
|
|
select {
|
|
case <-threadDone:
|
|
return
|
|
case <-time.After(time.Duration(interval) * time.Second):
|
|
state.Fetch()
|
|
}
|
|
}
|
|
}
|