From 2c01cc000e3705f399319d8527b50ddbf0f50e69 Mon Sep 17 00:00:00 2001 From: Antony Male Date: Mon, 7 Dec 2015 11:11:01 +0000 Subject: [PATCH] Add more logging in the case of relaypoolsrv internal server error It's useful to know *why* relaypoolsrv returns an internal server error --- cmd/relaysrv/pool.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cmd/relaysrv/pool.go b/cmd/relaysrv/pool.go index 9bd9762da..bdf65232a 100644 --- a/cmd/relaysrv/pool.go +++ b/cmd/relaysrv/pool.go @@ -28,17 +28,13 @@ func poolHandler(pool string, uri *url.URL) { if err != nil { log.Println("Error joining pool", pool, err) } else if resp.StatusCode == 500 { - if debug { - bs, err := ioutil.ReadAll(resp.Body) - if err != nil { - log.Println("Failed to read response body for", pool, err) - } else { - log.Println("Response for", pool, string(bs)) - } - resp.Body.Close() + bs, err := ioutil.ReadAll(resp.Body) + if err != nil { + log.Println("Failed to join", pool, "due to an internal server error. Could not read response:", err) } else { - log.Println(pool, "failed to join due to an internal server error") + log.Println("Failed to join", pool, "due to an internal server error:", string(bs)) } + resp.Body.Close() } else if resp.StatusCode == 429 { log.Println(pool, "under load, will retry in a minute") time.Sleep(time.Minute)