aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/client/DefaultRetryStrategy.cpp
blob: 7e57c79ffc4b127aaa0061b1b245a7e86eb463b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#include <aws/core/client/DefaultRetryStrategy.h>

#include <aws/core/client/AWSError.h>
#include <aws/core/utils/UnreferencedParam.h>

using namespace Aws;
using namespace Aws::Client;

bool DefaultRetryStrategy::ShouldRetry(const AWSError<CoreErrors>& error, long attemptedRetries) const
{    
    if (attemptedRetries >= m_maxRetries)
        return false;

    return error.ShouldRetry();
}

long DefaultRetryStrategy::CalculateDelayBeforeNextRetry(const AWSError<CoreErrors>& error, long attemptedRetries) const
{
    AWS_UNREFERENCED_PARAM(error);

    if (attemptedRetries == 0)
    {
        return 0;
    }

    return (1 << attemptedRetries) * m_scaleFactor;
}