final class RetryPolicy

Properties

FatalRequestException|RequestException): int $delay

The delay resolver.

null|FatalRequestException|PendingRequest): bool $when

The retry condition.

Methods

__construct(array|int $times = 1, Closure|int $sleepMilliseconds = 0, callable|null $when = null, bool $throw = true)

Create a retry policy.

int
maximumAttempts()

Get the maximum number of attempts.

int
delayFor(int $attempt, FatalRequestException|RequestException $exception)

Resolve the delay before the next attempt.

Details

at line 36
__construct(array|int $times = 1, Closure|int $sleepMilliseconds = 0, callable|null $when = null, bool $throw = true)

Create a retry policy.

Parameters

array|int $times
Closure|int $sleepMilliseconds
callable|null $when
bool $throw

at line 65
int maximumAttempts()

Get the maximum number of attempts.

Return Value

int

at line 73
int delayFor(int $attempt, FatalRequestException|RequestException $exception)

Resolve the delay before the next attempt.

Parameters

int $attempt
FatalRequestException|RequestException $exception

Return Value

int