Copied!

Middleware that retries requests based on the boolean result of invoking the provided "decider" function.

  • final
CloneableInstantiable
Methods
public __construct(callable $decider, callable $nextHandler, ?callable $delay = NULL)
 
  • param callable $decider Function that accepts the number of retries, a request, [response], and [exception] and returns true if the request is to be retried.
  • param callable $nextHandler Next handler to invoke.
  • param callable|null $delay Function that accepts the number of retries and returns the number of milliseconds to delay.
public __invoke(Psr\Http\Message\RequestInterface $request, array $options) : GuzzleHttp\Promise\PromiseInterface
public static exponentialDelay(int $retries) : int
 

Default exponential backoff delay function.

  • return int milliseconds.
Properties
private $decider = NULL
 
  • var callable
private $delay = NULL
 
  • @var
private $nextHandler = NULL
 
  • var callable
Methods
private doRetry(Psr\Http\Message\RequestInterface $request, array $options, ?Psr\Http\Message\ResponseInterface $response = NULL) : GuzzleHttp\Promise\PromiseInterface
private onFulfilled(Psr\Http\Message\RequestInterface $request, array $options) : callable
 

Execute fulfilled closure

private onRejected(Psr\Http\Message\RequestInterface $req, array $options) : callable
 

Execute rejected closure

Methods
public static exponentialDelay(int $retries) : int
 

Default exponential backoff delay function.

  • return int milliseconds.
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration