[ARVADOS] updated: cef1d949ecc75417a3575be79f683b2b0048953f

git at public.curoverse.com git at public.curoverse.com
Fri Oct 9 16:39:52 EDT 2015


Summary of changes:
 sdk/go/keepclient/keepclient.go | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

       via  cef1d949ecc75417a3575be79f683b2b0048953f (commit)
      from  1996b03c10e45d4c1959b40333c57261a040bffb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit cef1d949ecc75417a3575be79f683b2b0048953f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Oct 9 16:41:52 2015 -0400

    7491: Fix response body close, error logging.

diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go
index eb011f0..2f9ea44 100644
--- a/sdk/go/keepclient/keepclient.go
+++ b/sdk/go/keepclient/keepclient.go
@@ -167,11 +167,9 @@ func (kc *KeepClient) getOrHead(method string, locator string) (io.ReadCloser, i
 				retryList = append(retryList, host)
 			} else if resp.StatusCode != http.StatusOK {
 				var respbody []byte
-				if resp.Body != nil {
-					respbody, _ = ioutil.ReadAll(&io.LimitedReader{resp.Body, 4096})
-					resp.Body.Close()
-				}
-				errs = append(errs, fmt.Sprintf("%s: %d %s",
+				respbody, _ = ioutil.ReadAll(&io.LimitedReader{resp.Body, 4096})
+				resp.Body.Close()
+				errs = append(errs, fmt.Sprintf("%s: HTTP %d %q",
 					url, resp.StatusCode, bytes.TrimSpace(respbody)))
 
 				if resp.StatusCode == 408 ||
@@ -191,6 +189,7 @@ func (kc *KeepClient) getOrHead(method string, locator string) (io.ReadCloser, i
 						Check:  locator[0:32],
 					}, resp.ContentLength, url, nil
 				} else {
+					resp.Body.Close()
 					return nil, resp.ContentLength, url, nil
 				}
 			}
@@ -198,7 +197,7 @@ func (kc *KeepClient) getOrHead(method string, locator string) (io.ReadCloser, i
 		}
 		serversToTry = retryList
 	}
-	log.Printf("DEBUG: GET %s failed: %v", locator, errs)
+	log.Printf("DEBUG: %s %s failed: %v", method, locator, errs)
 
 	return nil, 0, "", BlockNotFound
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list