ThrottlingErrorChecker
extends AbstractBackoffStrategy
in package
Backoff logic that handles throttling exceptions from services
Table of Contents
Properties
- $exceptionParser : ExceptionParserInterface
- $next : AbstractBackoffStrategy
- $throttlingExceptions : array<string|int, mixed>
Methods
- __construct() : mixed
- getBackoffPeriod() : bool|int
- Get the amount of time to delay in seconds before retrying a request
- 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() : bool|int|null
- Implement the concrete strategy
Properties
$exceptionParser
protected
ExceptionParserInterface
$exceptionParser
Exception parser used to parse exception responses
$next
protected
AbstractBackoffStrategy
$next
Next strategy in the chain
$throttlingExceptions
protected
static array<string|int, mixed>
$throttlingExceptions
= array('RequestLimitExceeded' => true, 'Throttling' => true, 'ThrottlingException' => true, 'ProvisionedThroughputExceededException' => true, 'RequestThrottled' => true)
Whitelist of exception codes (as indexes) that indicate throttling
Methods
__construct()
public
__construct(ExceptionParserInterface $exceptionParser[, BackoffStrategyInterface $next = null ]) : mixed
Parameters
- $exceptionParser : ExceptionParserInterface
- $next : BackoffStrategyInterface = null
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
getNext()
Get the next backoff strategy in the chain
public
getNext() : AbstractBackoffStrategy|null
Return values
AbstractBackoffStrategy|nullmakesDecision()
Check if the strategy does filtering and makes decisions on whether or not to retry.
public
makesDecision() : bool
Return values
boolsetNext()
public
setNext(AbstractBackoffStrategy $next) : mixed
Parameters
- $next : AbstractBackoffStrategy
-
Next strategy in the chain
getDelay()
Implement the concrete strategy
protected
getDelay(mixed $retries, RequestInterface $request[, Response $response = null ][, HttpException $e = null ]) : bool|int|null
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|null —Returns false to not retry or the number of seconds to delay between retries. Return true or null to defer to the next strategy if available, and if not, return 0.