Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/RetryMiddlewareFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class RetryMiddlewareFactory

public static function createInternalErrorsMiddleware(
?callable $delayFunction = null,
int $maxRetries = static::DEFAULT_MAX_RETRIES
int $maxRetries = self::DEFAULT_MAX_RETRIES
) {
return static::createMiddlewareByHttpCodeRanges(
static::INTERNAL_ERROR_RANGES,
Expand All @@ -27,15 +27,15 @@ public static function createInternalErrorsMiddleware(

public static function createRateLimitMiddleware(
?callable $delayFunction = null,
int $maxRetries = static::DEFAULT_MAX_RETRIES
int $maxRetries = self::DEFAULT_MAX_RETRIES
) {
return static::createMiddlewareByHttpCodes([429], $delayFunction, $maxRetries);
}

public static function createMiddlewareByHttpCodes(
array $codes,
?callable $delayFunction,
int $maxRetries = static::DEFAULT_MAX_RETRIES
int $maxRetries = self::DEFAULT_MAX_RETRIES
): callable {
return Middleware::retry(
static::getRetryFunction($codes, $maxRetries),
Expand All @@ -47,7 +47,7 @@ public static function createMiddlewareByHttpCodeRange(
int $from,
int $to,
?callable $delayFunction,
int $maxRetries = static::DEFAULT_MAX_RETRIES
int $maxRetries = self::DEFAULT_MAX_RETRIES
): callable {
return static::createMiddlewareByHttpCodeRanges([[$from, $to]], $delayFunction, $maxRetries);
}
Expand All @@ -60,7 +60,7 @@ public static function createMiddlewareByHttpCodeRange(
public static function createMiddlewareByHttpCodeRanges(
array $ranges,
?callable $delayFunction,
int $maxRetries = static::DEFAULT_MAX_RETRIES
int $maxRetries = self::DEFAULT_MAX_RETRIES
): callable {
return Middleware::retry(
static::getRetryFunctionByRanges($ranges, $maxRetries),
Expand Down Expand Up @@ -106,14 +106,14 @@ public static function getRetryFunctionByRanges(
public static function getRetryFunctionByRange(
int $from,
int $to,
int $maxRetries = static::DEFAULT_MAX_RETRIES
int $maxRetries = self::DEFAULT_MAX_RETRIES
): callable {
return static::getRetryFunctionByRanges([['from' => $from, 'to' => $to]], $maxRetries);
}

public static function getRetryFunction(
array $codes,
int $maxRetries = static::DEFAULT_MAX_RETRIES
int $maxRetries = self::DEFAULT_MAX_RETRIES
): callable {
return function (
$retries,
Expand Down