You are here

private static function MiddlewareFactory::retryDecider in Lockr 7.3

Return value

callable

1 call to MiddlewareFactory::retryDecider()
MiddlewareFactory::retry in vendor/lockr/lockr/src/Guzzle/MiddlewareFactory.php

File

vendor/lockr/lockr/src/Guzzle/MiddlewareFactory.php, line 36

Class

MiddlewareFactory

Namespace

Lockr\Guzzle

Code

private static function retryDecider() {
  return function ($retries, RequestInterface $req, ResponseInterface $resp = null, RequestException $ex = null) {
    if ($retries >= 5) {
      return false;
    }
    if ($ex instanceof ConnectException) {
      return true;
    }
    if ($resp) {
      if ($resp
        ->getStatusCode() >= 500) {
        return true;
      }
    }
    return false;
  };
}