Documentation

RetryMiddleware
in package

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

Table of Contents

$decider  : callable
$delay  : callable
$nextHandler  : callable
__construct()  : mixed
__invoke()  : PromiseInterface
exponentialDelay()  : int
Default exponential backoff delay function.
doRetry()  : self
onFulfilled()  : mixed
Execute fulfilled closure
onRejected()  : callable
Execute rejected closure

Properties

Methods

__construct()

public __construct(callable $decider, callable $nextHandler[, callable $delay = null ]) : mixed
Parameters
$decider : callable

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

$nextHandler : callable

Next handler to invoke.

$delay : callable = null

Function that accepts the number of retries and [response] and returns the number of milliseconds to delay.

Return values
mixed

exponentialDelay()

Default exponential backoff delay function.

public static exponentialDelay(int $retries) : int
Parameters
$retries : int
Return values
int

milliseconds.

Search results