diff options
Diffstat (limited to 'vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ExponentialBackoffStrategy.php')
-rw-r--r-- | vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ExponentialBackoffStrategy.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ExponentialBackoffStrategy.php b/vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ExponentialBackoffStrategy.php new file mode 100644 index 0000000..fb2912d --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ExponentialBackoffStrategy.php @@ -0,0 +1,25 @@ +<?php + +namespace Guzzle\Plugin\Backoff; + +use Guzzle\Http\Message\RequestInterface; +use Guzzle\Http\Message\Response; +use Guzzle\Http\Exception\HttpException; + +/** + * Implements an exponential backoff retry strategy. + * + * Warning: If no decision making strategies precede this strategy in the the chain, then all requests will be retried + */ +class ExponentialBackoffStrategy extends AbstractBackoffStrategy +{ + public function makesDecision() + { + return false; + } + + protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null) + { + return (int) pow(2, $retries); + } +} |