Просмотр исходного кода

Merge pull request #39206 from ijc/no-retry-ping-on-errconn

client: do not fallback to GET if HEAD on _ping fail to connect
Brian Goff 6 лет назад
Родитель
Сommit
de6df469f1
1 измененных файлов с 2 добавлено и 0 удалено
  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
 			return parsePingResponse(cli, serverResp)
 		}
+	} else if IsErrConnectionFailed(err) {
+		return ping, err
 	}
 
 	req, err = cli.buildRequest("GET", path.Join(cli.basePath, "/_ping"), nil, nil)