public static function Middleware::retry in Lockr 7.3
Middleware that retries requests based on the boolean result of invoking the provided "decider" function.
If no delay function is provided, a simple implementation of exponential backoff will be utilized.
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 $delay Function that accepts the number of retries and: returns the number of milliseconds to delay.
Return value
callable Returns a function that accepts the next handler.
1 call to Middleware::retry()
- MiddlewareFactory::retry in vendor/
lockr/ lockr/ src/ Guzzle/ MiddlewareFactory.php
File
- vendor/
guzzlehttp/ guzzle/ src/ Middleware.php, line 169
Class
- Middleware
- Functions used to create and wrap handlers with handler middleware.
Namespace
GuzzleHttpCode
public static function retry(callable $decider, callable $delay = null) {
return function (callable $handler) use ($decider, $delay) {
return new RetryMiddleware($decider, $handler, $delay);
};
}