CurlBackoffStrategy
extends AbstractErrorCodeBackoffStrategy
in package
Strategy used to retry when certain cURL error codes are encountered.
Table of Contents
- $defaultErrorCodes : array<string|int, mixed>
- $errorCodes : array<string|int, mixed>
- $next : AbstractBackoffStrategy
- __construct() : mixed
- getBackoffPeriod() : bool|int
- Get the amount of time to delay in seconds before retrying a request
- getDefaultFailureCodes() : array<string|int, mixed>
- Get the default failure codes to retry
- getNext() : AbstractBackoffStrategy|null
- Get the next backoff strategy in the chain
- makesDecision() : bool
- Check if the strategy does filtering and makes decisions on whether or not to retry.
- setNext() : mixed
- getDelay() : mixed
Properties
$defaultErrorCodes
protected
static array<string|int, mixed>
$defaultErrorCodes
= array(CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_CONNECT, CURLE_PARTIAL_FILE, CURLE_WRITE_ERROR, CURLE_READ_ERROR, CURLE_OPERATION_TIMEOUTED, CURLE_SSL_CONNECT_ERROR, CURLE_HTTP_PORT_FAILED, CURLE_GOT_NOTHING, CURLE_SEND_ERROR, CURLE_RECV_ERROR)
Default cURL errors to retry
$errorCodes
protected
array<string|int, mixed>
$errorCodes
Error codes that can be retried
$next
protected
AbstractBackoffStrategy
$next
Next strategy in the chain
Methods
__construct()
public
__construct([array<string|int, mixed> $codes = null ][, BackoffStrategyInterface $next = null ]) : mixed
Parameters
- $codes : array<string|int, mixed> = null
-
Array of codes that should be retried
- $next : BackoffStrategyInterface = null
-
The optional next strategy
Return values
mixed —getBackoffPeriod()
Get the amount of time to delay in seconds before retrying a request
public
getBackoffPeriod(mixed $retries, RequestInterface $request[, Response $response = null ][, HttpException $e = null ]) : bool|int
Parameters
- $retries : mixed
-
Number of retries of the request
- $request : RequestInterface
-
Request that was sent
- $response : Response = null
-
Response that was received. Note that there may not be a response
- $e : HttpException = null
-
Exception that was encountered if any
Return values
bool|int —Returns false to not retry or the number of seconds to delay between retries
getDefaultFailureCodes()
Get the default failure codes to retry
public
static getDefaultFailureCodes() : array<string|int, mixed>
Return values
array<string|int, mixed> —getNext()
Get the next backoff strategy in the chain
public
getNext() : AbstractBackoffStrategy|null
Return values
AbstractBackoffStrategy|null —makesDecision()
Check if the strategy does filtering and makes decisions on whether or not to retry.
public
abstract makesDecision() : bool
Strategies that return false will never retry if all of the previous strategies in a chain defer on a backoff decision.
Return values
bool —setNext()
public
setNext(AbstractBackoffStrategy $next) : mixed
Parameters
- $next : AbstractBackoffStrategy
-
Next strategy in the chain
Return values
mixed —getDelay()
protected
getDelay(mixed $retries, RequestInterface $request[, Response $response = null ][, HttpException $e = null ]) : mixed
Parameters
- $retries : mixed
- $request : RequestInterface
- $response : Response = null
- $e : HttpException = null