Skip to content

retry via connector when rate limit sleep follows manual exceed#29

Open
JonPurvis wants to merge 2 commits intosaloonphp:v2from
JonPurvis:saloon-issue-532
Open

retry via connector when rate limit sleep follows manual exceed#29
JonPurvis wants to merge 2 commits intosaloonphp:v2from
JonPurvis:saloon-issue-532

Conversation

@JonPurvis
Copy link
Contributor

@JonPurvis JonPurvis commented Mar 22, 2026

Fixes saloonphp/saloon#532

When HasRateLimits is applied to a Request (not a Connector), a 429 handled with getTooManyAttemptsLimiter()->sleep() triggers a retry that called $this->send(). send() exists on Connector, not Request, so the retry fails (e.g. BadMethodCallException via Macroable, or an undefined-method error depending on context).

This PR introduces some changes:

Retry using $response->getConnector()->send($response->getRequest()) so the retry always goes through the connector.
Use $limitThatWasExceeded->getShouldSleep() instead of the loop’s last $limit when deciding whether to throw vs sleep/retry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HasRateLimits on Request class throws "Call to undefined method send()" when 429 with sleep() is triggered

1 participant