@@ -44,8 +44,8 @@ namespace Aws
4444 long CalculateDelay (const AWSError<CoreErrors>& error, long attemptedRetries) const override
4545 {
4646 double x = error.ShouldThrottle () ? 1.0 : 0.05 ;
47- double exponentialPart = x * static_cast <double >(1L << std::min (attemptedRetries, 30L ));
48- double cappedPart = std::min (exponentialPart, 20.0 );
47+ double exponentialPart = x * static_cast <double >(1L << ( std::min) (attemptedRetries, 30L ));
48+ double cappedPart = ( std::min) (exponentialPart, 20.0 );
4949
5050 double b = static_cast <double >(Aws::Utils::GetRandomValue () % 10000 ) / 10000.0 ;
5151 double t_i = b * cappedPart;
@@ -55,7 +55,7 @@ namespace Aws
5555 if (it != headers.end ())
5656 {
5757 double headerSec = static_cast <double >(Aws::Utils::StringUtils::ConvertToInt64 (it->second .c_str ())) / 1000.0 ;
58- double clamped = std::max (t_i, std::min (headerSec, 5.0 + t_i));
58+ double clamped = ( std::max) (t_i, ( std::min) (headerSec, 5.0 + t_i));
5959 return static_cast <long >(clamped * 1000.0 );
6060 }
6161
@@ -160,41 +160,5 @@ namespace Aws
160160 ReleaseRetryQuota (capacityAmount);
161161 }
162162
163- ThrottleBasedRetryQuotaContainer::ThrottleBasedRetryQuotaContainer (int retryCost, int throttlingRetryCost)
164- : m_retryQuota(INITIAL_RETRY_TOKENS ), m_retryCost(retryCost), m_throttlingRetryCost(throttlingRetryCost)
165- {}
166-
167- bool ThrottleBasedRetryQuotaContainer::AcquireRetryQuota (int capacityAmount)
168- {
169- WriterLockGuard guard (m_retryQuotaLock);
170-
171- if (capacityAmount > m_retryQuota)
172- {
173- return false ;
174- }
175- else
176- {
177- m_retryQuota -= capacityAmount;
178- return true ;
179- }
180- }
181-
182- bool ThrottleBasedRetryQuotaContainer::AcquireRetryQuota (const AWSError<CoreErrors>& error)
183- {
184- int capacityAmount = error.ShouldThrottle () ? m_throttlingRetryCost : m_retryCost;
185- return AcquireRetryQuota (capacityAmount);
186- }
187-
188- void ThrottleBasedRetryQuotaContainer::ReleaseRetryQuota (int capacityAmount)
189- {
190- WriterLockGuard guard (m_retryQuotaLock);
191- m_retryQuota = (std::min)(m_retryQuota + capacityAmount, INITIAL_RETRY_TOKENS );
192- }
193-
194- void ThrottleBasedRetryQuotaContainer::ReleaseRetryQuota (const AWSError<CoreErrors>& error)
195- {
196- int capacityAmount = error.ShouldThrottle () ? m_throttlingRetryCost : m_retryCost;
197- ReleaseRetryQuota (capacityAmount);
198- }
199163 }
200164}
0 commit comments