Skip to content

Commit f4a17cd

Browse files
fix: ensure HTTP 503 responses are returned for failover processing instead of throwing ServerException
1 parent 881ecfb commit f4a17cd

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

client-v2/src/main/java/com/clickhouse/client/api/internal/HttpAPIClientHelper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,8 @@ private ClassicHttpResponse doPostRequest(Map<String, Object> requestConfig, Htt
578578
} else if (httpResponse.getCode() == HttpStatus.SC_BAD_GATEWAY) {
579579
httpResponse.close();
580580
throw new ClientException("Server returned '502 Bad gateway'. Check network and proxy settings.");
581+
} else if (httpResponse.getCode() == HttpStatus.SC_SERVICE_UNAVAILABLE) {
582+
return httpResponse;
581583
} else if (httpResponse.getCode() >= HttpStatus.SC_BAD_REQUEST || httpResponse.containsHeader(ClickHouseHttpProto.HEADER_EXCEPTION_CODE)) {
582584
try {
583585
throw readError(req, httpResponse);

0 commit comments

Comments
 (0)