HumHub Documentation (unofficial)

GenericRetryStrategy
in package
implements RetryStrategyInterface

Decides to retry the request when HTTP status codes belong to the given list of codes.

Tags
author

Jérémy Derussé jeremy@derusse.com

Table of Contents

Interfaces

RetryStrategyInterface

Constants

DEFAULT_RETRY_STATUS_CODES  = [ 0 => self::IDEMPOTENT_METHODS, // for transport exceptions 423, 425, 429, 500 => self::IDEMPOTENT_METHODS, 502, 503, 504 => self::IDEMPOTENT_METHODS, 507 => self::IDEMPOTENT_METHODS, 510 => self::IDEMPOTENT_METHODS, ]
IDEMPOTENT_METHODS  = ['GET', 'HEAD', 'PUT', 'DELETE', 'OPTIONS', 'TRACE']

Properties

$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 => self::IDEMPOTENT_METHODS, // for transport exceptions 423, 425, 429, 500 => self::IDEMPOTENT_METHODS, 502, 503, 504 => self::IDEMPOTENT_METHODS, 507 => self::IDEMPOTENT_METHODS, 510 => self::IDEMPOTENT_METHODS, ]

IDEMPOTENT_METHODS

public mixed IDEMPOTENT_METHODS = ['GET', 'HEAD', 'PUT', 'DELETE', 'OPTIONS', 'TRACE']

Properties

Methods

__construct()

public __construct([array<string|int, mixed> $statusCodes = self::DEFAULT_RETRY_STATUS_CODES ][, int $delayMs = 1000 ][, float $multiplier = 2.0 ][, int $maxDelayMs = 0 ][, float $jitter = 0.1 ]) : mixed
Parameters
$statusCodes : array<string|int, mixed> = self::DEFAULT_RETRY_STATUS_CODES

List of HTTP status codes that trigger a retry

$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)


        
On this page

Search results