Skip to content
Open
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
7 changes: 5 additions & 2 deletions src/Traits/HasRateLimits.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,18 @@ public function bootHasRateLimits(PendingRequest $pendingRequest): void
// place. We should make sure to throw the exception here.

if (isset($limitThatWasExceeded)) {
if (! $limit->getShouldSleep()) {
if (! $limitThatWasExceeded->getShouldSleep()) {
$this->throwLimitException($limitThatWasExceeded);
}

// When the limit has been instructed to sleep() we will make the request
// again, which will trigger the request middleware to sleep, and then
// hopefully get a successful response afterward.
//
// Always delegate to the connector: send() exists on Connector but not on Request
// (see saloonphp/saloon#532).

return $this->send($response->getRequest());
return $response->getConnector()->send($response->getRequest());
}

return $response;
Expand Down
Loading