Skip to content

Commit

Permalink
Adding BackoffRetryPlugin from Guzzle.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Mar 2, 2014
1 parent 9ad1153 commit 728e3b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Tmdb/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 728e3b3

Please sign in to comment.