minor stuff
This commit is contained in:
parent
911c30b409
commit
279e2e7441
@ -42,7 +42,7 @@ func PollMastodonPleroma(endpoint string, reportPostChan chan ReportPost) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode == TOOMANYREQUESTS { // Short Delay, 30 seconds
|
if resp.StatusCode == TOOMANYREQUESTS { // Short Delay, 30 seconds
|
||||||
log.Print("Delaying " + endpoint + ", gave status ", resp.StatusCode, " 1 hour delay")
|
log.Print("Delaying " + endpoint + ", gave status ", resp.StatusCode, ", 1 hour delay")
|
||||||
_, _ = ioutil.ReadAll(resp.Body)
|
_, _ = ioutil.ReadAll(resp.Body)
|
||||||
resp.Body.Close() // Release as soon as done
|
resp.Body.Close() // Release as soon as done
|
||||||
ri_mutex.Lock()
|
ri_mutex.Lock()
|
||||||
@ -55,8 +55,8 @@ func PollMastodonPleroma(endpoint string, reportPostChan chan ReportPost) {
|
|||||||
unprocess_error = unprocess_error + 1
|
unprocess_error = unprocess_error + 1
|
||||||
time.Sleep(time.Second * 30)
|
time.Sleep(time.Second * 30)
|
||||||
continue
|
continue
|
||||||
} else if resp.StatusCode == UNPROCESSABLE_ENTITY || resp.StatusCode == INTERNAL_ERROR { // Longer delay, 1 hour
|
} else if resp.StatusCode == INTERNAL_ERROR { // Longer delay, 1 hour
|
||||||
log.Print("Suspending " + endpoint + ", gave status ", resp.StatusCode, " 1 hour delay")
|
log.Print("Suspending " + endpoint + ", gave status ", resp.StatusCode, ", 1 hour delay")
|
||||||
_, _ = ioutil.ReadAll(resp.Body)
|
_, _ = ioutil.ReadAll(resp.Body)
|
||||||
resp.Body.Close() // Release as soon as done
|
resp.Body.Close() // Release as soon as done
|
||||||
ri_mutex.Lock()
|
ri_mutex.Lock()
|
||||||
@ -78,14 +78,6 @@ func PollMastodonPleroma(endpoint string, reportPostChan chan ReportPost) {
|
|||||||
|
|
||||||
err = json.NewDecoder(resp.Body).Decode(&newposts)
|
err = json.NewDecoder(resp.Body).Decode(&newposts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("-----------------")
|
|
||||||
fmt.Println("Error Message 1:", resp.StatusCode, err, err.Error, endpoint, resp.Status)
|
|
||||||
fmt.Println("-----------------")
|
|
||||||
q, err := ioutil.ReadAll(resp.Body)
|
|
||||||
fmt.Println(string(q))
|
|
||||||
fmt.Println(q)
|
|
||||||
fmt.Println(err)
|
|
||||||
resp.Body.Close() // Release as soon as done
|
|
||||||
if parsing_error > 5 {
|
if parsing_error > 5 {
|
||||||
ri_mutex.Lock()
|
ri_mutex.Lock()
|
||||||
m.Status = BAD_RESPONSE
|
m.Status = BAD_RESPONSE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user