Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinming-Hu committed May 30, 2024
1 parent 7ffedf6 commit 929035c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions sdk/storage/azure-storage-common/src/storage_retry_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@ namespace Azure { namespace Storage { namespace _internal {
>= 400)
{
const auto& headers = response->GetHeaders();
auto ite = headers.find("x-ms-copy-source-status-code");
auto ite = headers.find("x-ms-copy-source-error-code");
if (ite != headers.end())
{
const auto innerStatusCodeInt = std::stoi(ite->second);
const auto innerStatusCode = static_cast<Core::Http::HttpStatusCode>(innerStatusCodeInt);

const bool shouldRetry
= retryOptions.StatusCodes.find(innerStatusCode) != retryOptions.StatusCodes.end();
const auto& errorCode = ite->second;
const bool shouldRetry = errorCode == "InternalError" || errorCode == "OperationTimedOut"
|| errorCode == "ServerBusy";

if (Azure::Core::Diagnostics::_internal::Log::ShouldWrite(
Azure::Core::Diagnostics::Logger::Level::Informational))
{
Azure::Core::Diagnostics::_internal::Log::Write(
Azure::Core::Diagnostics::Logger::Level::Informational,
std::string("x-ms-copy-source-status-code ") + std::to_string(innerStatusCodeInt)
std::string("x-ms-copy-source-error-code ") + errorCode
+ (shouldRetry ? " will be retried" : " won't be retried"));
}
if (shouldRetry)
Expand Down

0 comments on commit 929035c

Please sign in to comment.