diff --git a/stream.go b/stream.go index 9aa9d20..1228c36 100644 --- a/stream.go +++ b/stream.go @@ -15,6 +15,7 @@ func StreamMastodon(endpoint string, o *RunningInstance) { //var client_id string //var client_secret string var oauthData OAuth + var retry bool for { @@ -78,12 +79,13 @@ func StreamMastodon(endpoint string, o *RunningInstance) { case "data": switch name { case "update": - jsoner := token[1][1:] - err := json.Unmarshal([]byte(jsoner), &newpost) + jsondata := token[1][1:] + err := json.Unmarshal([]byte(jsondata), &newpost) if err != nil { continue log.Fatal("Unable to unmarshal with error: ", err) } + retry = true default: continue } @@ -108,7 +110,11 @@ func StreamMastodon(endpoint string, o *RunningInstance) { ri_mutex.Unlock() } } - time.Sleep(time.Minute * 30) + if retry == true { + time.Sleep(time.Minute * 30) + } else { + break + } } // ri_mutex.Lock()