Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased
- Sleep before a retry rather than after each try.

## v6.0.0 - 2025-10-28
- ⚠️ [Breaking] Remove `ApiVersion::LATEST` constant to prevent semver violations. The `apiVersion` parameter is now required in `Context::initialize()`. Developers must explicitly specify API versions. See the [migration guide](BREAKING_CHANGES_FOR_V6.md#removal-of-apiversionlatest-constant) for details.
Expand Down
5 changes: 3 additions & 2 deletions src/Clients/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,16 @@ protected function request(
$currentTries = 0;
do {
$currentTries++;
if ($currentTries > 1) {
usleep((int)($retryAfter * 1000000));
}

$response = HttpResponse::fromResponse($client->sendRequest($request));

if (in_array($response->getStatusCode(), self::RETRIABLE_STATUS_CODES)) {
$retryAfter = $response->hasHeader(HttpHeaders::RETRY_AFTER)
? $response->getHeaderLine(HttpHeaders::RETRY_AFTER)
: Context::$RETRY_TIME_IN_SECONDS;

usleep((int)($retryAfter * 1000000));
} else {
break;
}
Expand Down