From 1e50b13b76466f0e73962c52c24984c86b9fbf51 Mon Sep 17 00:00:00 2001 From: Elis Hirwing Date: Sat, 4 Nov 2017 22:14:40 +0100 Subject: [PATCH] Fetch SL data in a goroutine, but also make sure to not spam them while the goroutine is running --- src/statusscreen/SL.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/statusscreen/SL.go b/src/statusscreen/SL.go index 37e8206..a229c39 100644 --- a/src/statusscreen/SL.go +++ b/src/statusscreen/SL.go @@ -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 {