AwsRetryStrategy
extends GenericRetryStrategy
in package
Decides to retry the request when HTTP status codes belong to the given list of codes.
Tags
Table of Contents
Constants
- DEFAULT_RETRY_STATUS_CODES = [0, 423, 425, 429, 500, 502, 503, 504, 507, 510]
- IDEMPOTENT_METHODS = ['GET', 'HEAD', 'PUT', 'DELETE', 'OPTIONS', 'TRACE']
Properties
- $awsErrorFactory : AwsErrorFactoryInterface
- $delayMs : mixed
- $jitter : mixed
- $maxDelayMs : mixed
- $multiplier : mixed
- $statusCodes : mixed
Methods
- __construct() : mixed
- getDelay() : int
- Returns the time to wait in milliseconds.
- shouldRetry() : bool|null
- Returns whether the request should be retried.
Constants
DEFAULT_RETRY_STATUS_CODES
public
mixed
DEFAULT_RETRY_STATUS_CODES
= [0, 423, 425, 429, 500, 502, 503, 504, 507, 510]
IDEMPOTENT_METHODS
public
mixed
IDEMPOTENT_METHODS
= ['GET', 'HEAD', 'PUT', 'DELETE', 'OPTIONS', 'TRACE']
Properties
$awsErrorFactory
private
AwsErrorFactoryInterface
$awsErrorFactory
$delayMs
private
mixed
$delayMs
$jitter
private
mixed
$jitter
$maxDelayMs
private
mixed
$maxDelayMs
$multiplier
private
mixed
$multiplier
$statusCodes
private
mixed
$statusCodes
Methods
__construct()
public
__construct([array<int, int|array<string|int, string>> $statusCodes = self::DEFAULT_RETRY_STATUS_CODES ][, int $delayMs = 1000 ][, float $multiplier = 2.0 ][, int $maxDelayMs = 0 ][, float $jitter = 0.1 ][, AwsErrorFactoryInterface|null $awsErrorFactory = null ]) : mixed
Parameters
- $statusCodes : array<int, int|array<string|int, string>> = self::DEFAULT_RETRY_STATUS_CODES
- $delayMs : int = 1000
-
Amount of time to delay (or the initial value when multiplier is used)
- $multiplier : float = 2.0
-
Multiplier to apply to the delay each time a retry occurs
- $maxDelayMs : int = 0
-
Maximum delay to allow (0 means no maximum)
- $jitter : float = 0.1
-
Probability of randomness int delay (0 = none, 1 = 100% random)
- $awsErrorFactory : AwsErrorFactoryInterface|null = null
getDelay()
Returns the time to wait in milliseconds.
public
getDelay(AsyncContext $context, string|null $responseContent, TransportExceptionInterface|null $exception) : int
Parameters
- $context : AsyncContext
- $responseContent : string|null
- $exception : TransportExceptionInterface|null
Return values
intshouldRetry()
Returns whether the request should be retried.
public
shouldRetry(AsyncContext $context, string|null $responseContent, TransportExceptionInterface|null $exception) : bool|null
Parameters
- $context : AsyncContext
- $responseContent : string|null
-
Null is passed when the body did not arrive yet
- $exception : TransportExceptionInterface|null
Return values
bool|null —Returns null to signal that the body is required to take a decision