Jakub Sokołowski ecf69febbc rename State to AppState
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-07-04 09:06:36 -04:00

20 lines
315 B
Go

package main
import (
"time"
)
func FetchLoop(state *AppState, 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()
}
}
}