Fetch SL data in a goroutine, but also make sure to not spam them

while the goroutine is running
master
Elis Hirwing 2017-11-04 22:14:40 +01:00
parent 87e6ba7adf
commit 1e50b13b76
Signed by: etu
GPG Key ID: D57EFA625C9A925F
1 changed files with 2 additions and 1 deletions

View File

@ -58,7 +58,8 @@ func (sl *SL) GetOutput() []string {
// Check if it's time to refresh yet
if sl.nextRefresh <= time.Now().Unix() {
sl.getData()
sl.nextRefresh += 10
go sl.getData()
}
for _, v := range sl.lastResponse.ResponseData.Metros {