added stream retry, probably a bad approach
This commit is contained in:
parent
5473052519
commit
5914fc0890
10
stream.go
10
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()
|
||||
}
|
||||
}
|
||||
if retry == true {
|
||||
time.Sleep(time.Minute * 30)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// ri_mutex.Lock()
|
||||
|
Loading…
x
Reference in New Issue
Block a user