Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rattrayalex-stripe committed Oct 5, 2019
1 parent 5c2da7c commit 9f8463f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/HttpClient/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,13 @@ private function shouldRetry($errno, $rcode, $rheaders, $numRetries)

// The API may ask us not to retry (eg; if doing so would be a no-op)
// or advise us to retry (eg; in cases of lock timeouts); we defer to that.
if (isset($rheaders['stripe-should-retry']) && $rheaders['stripe-should-retry'] === 'false') {
return false;
}
if ($rheaders['stripe-should-retry'] === 'true') {
return true;
if (isset($rheaders['stripe-should-retry'])) {
if ($rheaders['stripe-should-retry'] === 'false') {
return false;
}
if ($rheaders['stripe-should-retry'] === 'true') {
return true;
}
}

// 409 Conflict
Expand Down Expand Up @@ -416,7 +418,7 @@ private function sleepTime($numRetries, $rheaders)
$sleepSeconds = max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds);

// And never sleep less than the time the API asks us to wait, assuming it's a reasonable ask.
$retryAfter = floatval($rheaders['retry-after']);
$retryAfter = isset($rheaders['retry-after']) ? floatval($rheaders['retry-after']) : 0.0;
if (floor($retryAfter) == $retryAfter && $retryAfter <= Stripe::getMaxRetryAfter()) {
$sleepSeconds = max($sleepSeconds, $retryAfter);
}
Expand Down

0 comments on commit 9f8463f

Please sign in to comment.