14738: Enhances code readability when concatenating strings.
[arvados.git] / services / keepstore / proxy_remote.go
index 66bfce16e2b4578893419508513d72e836f090d4..1f82f3f4fc79d82c8f1a6fa1586410d94c9d76dc 100644 (file)
@@ -66,7 +66,7 @@ func (rp *remoteProxy) Get(ctx context.Context, w http.ResponseWriter, r *http.R
                        remoteID := part[1:6]
                        remote, ok := cluster.RemoteClusters[remoteID]
                        if !ok {
-                               http.Error(w, "remote cluster not configured", http.StatusBadGateway)
+                               http.Error(w, "remote cluster not configured", http.StatusBadRequest)
                                return
                        }
                        kc, err := rp.remoteClient(remoteID, remote, token)
@@ -174,6 +174,11 @@ func (rrc *remoteResponseCacher) Close() error {
                return nil
        }
        _, err := PutBlock(rrc.Context, rrc.Buffer, rrc.Locator[:32])
+       if rrc.Context.Err() != nil {
+               // If caller hung up, log that instead of subsequent/misleading errors.
+               http.Error(rrc.ResponseWriter, rrc.Context.Err().Error(), http.StatusGatewayTimeout)
+               return err
+       }
        if err == RequestHashError {
                http.Error(rrc.ResponseWriter, "checksum mismatch in remote response", http.StatusBadGateway)
                return err