added stream retry, probably a bad approach

This commit is contained in:
farhan 2020-12-29 16:41:43 +00:00
parent 5473052519
commit 5914fc0890

View File

@ -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()