1: <?php
2:
3: namespace Guzzle\Plugin\Backoff;
4:
5: use Guzzle\Http\Message\RequestInterface;
6: use Guzzle\Http\Message\Response;
7: use Guzzle\Http\Exception\HttpException;
8:
9: /**
10: * Will retry the request using the same amount of delay for each retry.
11: *
12: * Warning: If no decision making strategies precede this strategy in the the chain, then all requests will be retried
13: */
14: class ConstantBackoffStrategy extends AbstractBackoffStrategy
15: {
16: /**
17: * @var int Amount of time for each delay
18: */
19: protected $delay;
20:
21: /**
22: * @param int $delay Amount of time to delay between each additional backoff
23: */
24: public function __construct($delay)
25: {
26: $this->delay = $delay;
27: }
28:
29: /**
30: * {@inheritdoc}
31: */
32: public function makesDecision()
33: {
34: return false;
35: }
36:
37: /**
38: * {@inheritdoc}
39: */
40: protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null)
41: {
42: return $this->delay;
43: }
44: }
45: