Skip to content

Commit bdd7bf1

Browse files
authored
Fix | Retry via connector when rate limit sleep follows manual exceed (#29)
* retry via connector when rate limit sleep follows manual exceed * rerun tests
1 parent 8debc9d commit bdd7bf1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Traits/HasRateLimits.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,18 @@ public function bootHasRateLimits(PendingRequest $pendingRequest): void
9292
// place. We should make sure to throw the exception here.
9393

9494
if (isset($limitThatWasExceeded)) {
95-
if (! $limit->getShouldSleep()) {
95+
if (! $limitThatWasExceeded->getShouldSleep()) {
9696
$this->throwLimitException($limitThatWasExceeded);
9797
}
9898

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

103-
return $this->send($response->getRequest());
106+
return $response->getConnector()->send($response->getRequest());
104107
}
105108

106109
return $response;

0 commit comments

Comments
 (0)