diff --git a/lib/Tmdb/Client.php b/lib/Tmdb/Client.php index 0d4c2a74..4e109603 100644 --- a/lib/Tmdb/Client.php +++ b/lib/Tmdb/Client.php @@ -17,6 +17,7 @@ use Guzzle\Common\HasDispatcherInterface; use Guzzle\Http\Client as GuzzleClient; use Guzzle\Http\ClientInterface; +use Guzzle\Plugin\Backoff\BackoffPlugin; use Guzzle\Plugin\Cache\CachePlugin; use Guzzle\Plugin\Cache\DefaultCacheStorage; use Tmdb\HttpClient\HttpClient; @@ -118,6 +119,9 @@ private function constructHttpClient(ClientInterface $httpClient = null) $acceptJsonHeaderPlugin = new AcceptJsonHeaderPlugin(); $httpClient->addSubscriber($acceptJsonHeaderPlugin); + $backoffPlugin = BackoffPlugin::getExponentialBackoff(5); + $httpClient->addSubscriber($backoffPlugin); + if ($this->getToken() instanceof ApiToken) { $apiTokenPlugin = new ApiTokenPlugin($this->getToken()); $httpClient->addSubscriber($apiTokenPlugin);