From 279e2e744199387d13685c2d0278892138e22708 Mon Sep 17 00:00:00 2001 From: Farhan Khan Date: Mon, 30 Nov 2020 19:50:21 -0500 Subject: [PATCH] minor stuff --- poll/instance.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/poll/instance.go b/poll/instance.go index d9e62b4..5a44175 100644 --- a/poll/instance.go +++ b/poll/instance.go @@ -42,7 +42,7 @@ func PollMastodonPleroma(endpoint string, reportPostChan chan ReportPost) { } 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) resp.Body.Close() // Release as soon as done ri_mutex.Lock() @@ -55,8 +55,8 @@ func PollMastodonPleroma(endpoint string, reportPostChan chan ReportPost) { unprocess_error = unprocess_error + 1 time.Sleep(time.Second * 30) continue - } else if resp.StatusCode == UNPROCESSABLE_ENTITY || resp.StatusCode == INTERNAL_ERROR { // Longer delay, 1 hour - log.Print("Suspending " + endpoint + ", gave status ", resp.StatusCode, " 1 hour delay") + } else if resp.StatusCode == INTERNAL_ERROR { // Longer delay, 1 hour + log.Print("Suspending " + endpoint + ", gave status ", resp.StatusCode, ", 1 hour delay") _, _ = ioutil.ReadAll(resp.Body) resp.Body.Close() // Release as soon as done ri_mutex.Lock() @@ -78,14 +78,6 @@ func PollMastodonPleroma(endpoint string, reportPostChan chan ReportPost) { err = json.NewDecoder(resp.Body).Decode(&newposts) 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 { ri_mutex.Lock() m.Status = BAD_RESPONSE