Browse Source

Merge pull request #206 from thaJeztah/19.03_backport_no_retry_ping_on_errconn

[19.03 backport] client: do not fallback to GET if HEAD on _ping fail to connect
Sebastiaan van Stijn 6 years ago
parent
commit
7cc3681ad6
1 changed files with 2 additions and 0 deletions
  1. 2 0
      client/ping.go

+ 2 - 0
client/ping.go

@@ -31,6 +31,8 @@ func (cli *Client) Ping(ctx context.Context) (types.Ping, error) {
 			// Server handled the request, so parse the response
 			// Server handled the request, so parse the response
 			return parsePingResponse(cli, serverResp)
 			return parsePingResponse(cli, serverResp)
 		}
 		}
+	} else if IsErrConnectionFailed(err) {
+		return ping, err
 	}
 	}
 
 
 	req, err = cli.buildRequest("GET", path.Join(cli.basePath, "/_ping"), nil, nil)
 	req, err = cli.buildRequest("GET", path.Join(cli.basePath, "/_ping"), nil, nil)