\GuzzleHttpRetryMiddleware

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

Summary

Methods
Properties
Constants
__construct()
exponentialDelay()
__invoke()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
onFulfilled()
onRejected()
doRetry()
$nextHandler
$decider
$delay
N/A

Properties

$nextHandler

$nextHandler

$decider

$decider : callable

Type

callable

Methods

__construct()

__construct(callable  $decider, callable  $nextHandler, callable  $delay = null) : mixed

Parameters

callable $decider

Function that accepts the number of retries, a request, [response], and [exception] and returns true if the request is to be retried.

callable $nextHandler
callable $delay

Returns

mixed —

exponentialDelay()

exponentialDelay(int  $retries) : int

Default exponential backoff delay function.

Parameters

int $retries

Returns

int —

milliseconds.

__invoke()

__invoke(\Psr\Http\Message\RequestInterface  $request, array  $options) : \GuzzleHttp\Promise\PromiseInterface

Parameters

\Psr\Http\Message\RequestInterface $request
array $options

Returns

\GuzzleHttp\Promise\PromiseInterface —

onFulfilled()

onFulfilled(\Psr\Http\Message\RequestInterface  $request, array  $options) : callable

Execute fulfilled closure

Parameters

\Psr\Http\Message\RequestInterface $request
array $options

Returns

callable —

onRejected()

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

Execute rejected closure

Parameters

\Psr\Http\Message\RequestInterface $req
array $options

Returns

callable —

doRetry()

doRetry(\Psr\Http\Message\RequestInterface  $request, array  $options, \Psr\Http\Message\ResponseInterface  $response = null) : \GuzzleHttp\Promise\PromiseInterface

Parameters

\Psr\Http\Message\RequestInterface $request
array $options
\Psr\Http\Message\ResponseInterface $response

Returns

\GuzzleHttp\Promise\PromiseInterface —