diff options
| author | nadya73 <[email protected]> | 2024-04-18 12:01:09 +0300 |
|---|---|---|
| committer | nadya73 <[email protected]> | 2024-04-18 12:11:25 +0300 |
| commit | 044c22732c7e0fa5cbdd08543c7cd68a501170a6 (patch) | |
| tree | 1d2f571d26bd697eb3e30102cd8d90ae5a28a201 /yt/cpp/mapreduce/client/client_reader.cpp | |
| parent | 4d77c1fb4de7a121c720a5b403ba7aa516a32ce3 (diff) | |
[yt/cpp/mapreduce] YT-21405: Don't ignore backoff and pass actual exception in Retry()
Don't ignore backoff and pass actual exception in Retry()
b821c02fd21c9f8115cd2a4896372a9fda69e5f6
Diffstat (limited to 'yt/cpp/mapreduce/client/client_reader.cpp')
| -rw-r--r-- | yt/cpp/mapreduce/client/client_reader.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/yt/cpp/mapreduce/client/client_reader.cpp b/yt/cpp/mapreduce/client/client_reader.cpp index b080da26048..e1051fda964 100644 --- a/yt/cpp/mapreduce/client/client_reader.cpp +++ b/yt/cpp/mapreduce/client/client_reader.cpp @@ -82,15 +82,31 @@ TClientReader::TClientReader( bool TClientReader::Retry( const TMaybe<ui32>& rangeIndex, - const TMaybe<ui64>& rowIndex) + const TMaybe<ui64>& rowIndex, + const std::exception_ptr& error) { if (CurrentRequestRetryPolicy_) { - // TODO we should pass actual exception in Retry function - yexception genericError; - auto backoff = CurrentRequestRetryPolicy_->OnGenericError(genericError); - if (!backoff) { + TMaybe<TDuration> backoffDuration; + try { + std::rethrow_exception(error); + } catch (const TErrorResponse& ex) { + if (!IsRetriable(ex)) { + throw; + } + backoffDuration = CurrentRequestRetryPolicy_->OnRetriableError(ex); + } catch (const std::exception& ex) { + if (!IsRetriable(ex)) { + throw; + } + backoffDuration = CurrentRequestRetryPolicy_->OnGenericError(ex); + } catch (...) { + } + + if (!backoffDuration) { return false; } + + NDetail::TWaitProxy::Get()->Sleep(*backoffDuration); } try { |
