← All changes
|
vendor_prefixed/guzzlehttp/guzzle/src/RetryMiddleware.php
+6
-1
27.9
→
trunk
View file →
| @@ -39,17 +39,22 @@ | ||
| 39 | 39 | public function __construct(callable $decider, callable $nextHandler, ?callable $delay = null) |
| 40 | 40 | { |
| 41 | 41 | $this->decider = $decider; |
| 42 | 42 | $this->nextHandler = $nextHandler; |
| 43 | - $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; | |
| 43 | + $this->delay = $delay ?: static function (int $retries) : int { | |
| 44 | + return (int) 2 ** ($retries - 1) * 1000; | |
| 45 | + }; | |
| 44 | 46 | } |
| 45 | 47 | /** |
| 46 | 48 | * Default exponential backoff delay function. |
| 47 | 49 | * |
| 48 | 50 | * @return int milliseconds. |
| 51 | + * | |
| 52 | + * @deprecated since 7.11, will be removed in 8.0. | |
| 49 | 53 | */ |
| 50 | 54 | public static function exponentialDelay(int $retries) : int |
| 51 | 55 | { |
| 56 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.11', '%s::%s() is deprecated and will be removed in 8.0.', __CLASS__, __FUNCTION__); | |
| 52 | 57 | return (int) 2 ** ($retries - 1) * 1000; |
| 53 | 58 | } |
| 54 | 59 | public function __invoke(\YoastSEO_Vendor\Psr\Http\Message\RequestInterface $request, array $options) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface |
| 55 | 60 | { |