[ARVADOS] created: 8ff3305a11a7effb73ad9cfe2c55ba572e56f6b0

git at public.curoverse.com git at public.curoverse.com
Thu Oct 8 15:44:58 EDT 2015


        at  8ff3305a11a7effb73ad9cfe2c55ba572e56f6b0 (commit)


commit 8ff3305a11a7effb73ad9cfe2c55ba572e56f6b0
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Oct 6 13:48:05 2015 -0400

    7491: Ensure status channel stays open until all upload workers finish.

diff --git a/sdk/go/keepclient/support.go b/sdk/go/keepclient/support.go
index 63800b1..51e3e08 100644
--- a/sdk/go/keepclient/support.go
+++ b/sdk/go/keepclient/support.go
@@ -228,7 +228,17 @@ func (this KeepClient) putReplicas(
 
 	// Used to communicate status from the upload goroutines
 	upload_status := make(chan uploadStatus)
-	defer close(upload_status)
+	defer func() {
+		// Wait for any abandoned uploads (e.g., we started
+		// two uploads and the first replied with replicas=2)
+		// to finish before closing the status channel.
+		go func() {
+			for active > 0 {
+				<-upload_status
+			}
+			close(upload_status)
+		}()
+	}()
 
 	// Desired number of replicas
 	remaining_replicas := this.Want_replicas

commit a084ddc8af3f05ffe35392a86cf2400c5bbe2176
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Oct 6 13:39:12 2015 -0400

    7491: Fix error handling/reporting in keepclient/GET

diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go
index 53dfb2b..8b7cf41 100644
--- a/sdk/go/keepclient/keepclient.go
+++ b/sdk/go/keepclient/keepclient.go
@@ -140,21 +140,19 @@ func (kc *KeepClient) Get(locator string) (io.ReadCloser, int64, string, error)
 		url := host + "/" + locator
 		req, err := http.NewRequest("GET", url, nil)
 		if err != nil {
+			errs = append(errs, fmt.Sprintf("%s: %v", url, err))
 			continue
 		}
 		req.Header.Add("Authorization", fmt.Sprintf("OAuth2 %s", kc.Arvados.ApiToken))
 		resp, err := kc.Client.Do(req)
-		if err != nil || resp.StatusCode != http.StatusOK {
-			if resp != nil {
-				var respbody []byte
-				if resp.Body != nil {
-					respbody, _ = ioutil.ReadAll(&io.LimitedReader{resp.Body, 4096})
-				}
-				errs = append(errs, fmt.Sprintf("%s: %d %s",
-					url, resp.StatusCode, strings.TrimSpace(string(respbody))))
-			} else {
-				errs = append(errs, fmt.Sprintf("%s: %v", url, err))
-			}
+		if err != nil {
+			errs = append(errs, fmt.Sprintf("%s: %v", url, err))
+			continue
+		} else if resp.StatusCode != http.StatusOK {
+			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)))
 			continue
 		}
 		return HashCheckingReader{

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list