diff options
| author | hiddenpath <[email protected]> | 2025-02-17 10:07:07 +0300 |
|---|---|---|
| committer | hiddenpath <[email protected]> | 2025-02-17 10:32:13 +0300 |
| commit | 9295facf69eb8c6ee7bbb5bdfd55aac74c850432 (patch) | |
| tree | 5d06860b576b3fe45467ba669a7dd0f7e68f5128 /yt/cpp/mapreduce/http/http_client.cpp | |
| parent | 8c9859fab05712911b835114e4a6c8ad57a36834 (diff) | |
YT-23616: Do not rely on specific http codes upon request retry
commit_hash:6567d772f1cc5091a75ad5249c2a97a73dc5e6cd
Diffstat (limited to 'yt/cpp/mapreduce/http/http_client.cpp')
| -rw-r--r-- | yt/cpp/mapreduce/http/http_client.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/yt/cpp/mapreduce/http/http_client.cpp b/yt/cpp/mapreduce/http/http_client.cpp index 7e9d761c3cf..34be58daab6 100644 --- a/yt/cpp/mapreduce/http/http_client.cpp +++ b/yt/cpp/mapreduce/http/http_client.cpp @@ -7,6 +7,7 @@ #include <yt/cpp/mapreduce/interface/config.h> +#include <yt/cpp/mapreduce/interface/error_codes.h> #include <yt/cpp/mapreduce/interface/logging/yt_log.h> #include <yt/yt/core/concurrency/thread_pool_poller.h> @@ -42,21 +43,22 @@ TMaybe<TErrorResponse> GetErrorResponse(const TString& hostName, const TString& TErrorResponse errorResponse(static_cast<int>(httpCode), requestId); - auto logAndSetError = [&] (const TString& rawError) { + auto logAndSetError = [&] (int code, const TString& rawError) { YT_LOG_ERROR("RSP %v - HTTP %v - %v", requestId, httpCode, rawError.data()); - errorResponse.SetRawError(rawError); + errorResponse.SetError(TYtError(code, rawError)); }; + switch (httpCode) { case NHttp::EStatusCode::TooManyRequests: - logAndSetError("request rate limit exceeded"); + logAndSetError(NClusterErrorCodes::NSecurityClient::RequestQueueSizeLimitExceeded, "request rate limit exceeded"); break; case NHttp::EStatusCode::InternalServerError: - logAndSetError("internal error in proxy " + hostName); + logAndSetError(NClusterErrorCodes::NRpc::Unavailable, "internal error in proxy " + hostName); break; default: { @@ -80,6 +82,9 @@ TMaybe<TErrorResponse> GetErrorResponse(const TString& hostName, const TString& if (errorResponse.IsOk()) { return Nothing(); } + if (httpCode == NHttp::EStatusCode::ServiceUnavailable) { + ExtendGenericError(errorResponse, NClusterErrorCodes::NBus::TransportError, "transport error"); + } return errorResponse; } |
