Skip to content

[9.x] Http client: retry callback exception handling (follow-up to #41762) - #41792

Merged
taylorotwell merged 2 commits into
laravel:9.xfrom
gdebrauwer:http-client-retry-callback-exception-handling
Apr 2, 2022
Merged

[9.x] Http client: retry callback exception handling (follow-up to #41762)#41792
taylorotwell merged 2 commits into
laravel:9.xfrom
gdebrauwer:http-client-retry-callback-exception-handling

Conversation

@gdebrauwer

Copy link
Copy Markdown
Contributor

Follow-up to #41762.

Because the retryWhenCallback is now executed inside the global retry helper method, an extra attempt would be made if an exception occurred in the retryWhenCallback. This was not the case when the retryWhenCallback was used as a callback by the global retry helper method.
By wrapping it in a try-catch, we can set $shouldRetry to false before we throw the exception again. This ensures it does not make an unnecessary attempt.

@gdebrauwer gdebrauwer changed the title Http client retry callback exception handling [9.x] Http client: retry callback exception handling Apr 2, 2022
@gdebrauwer gdebrauwer changed the title [9.x] Http client: retry callback exception handling [9.x] Http client: retry callback exception handling (follow-up to #41762) Apr 2, 2022
@taylorotwell
taylorotwell merged commit 9879b90 into laravel:9.x Apr 2, 2022
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.

2 participants