Repository navigation
Replies: 1 comment
|
Likely a bug. It's inconsistent with the global The ProblemWith Why It Matters
Quick FixDon't rely on try {
Http::retry(times: [100, 200], when: $shouldRetry)->get($url);
} catch (RequestException $e) {
// Handle final failure here
}RecommendationFile an issue on the Laravel repository to clarify if intentional or fix it to match |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
It looks like
Http::retry()evaluates thewhencallback on the final failed attempt, even though there is no remaining attempt available.Example:
With
[100, 200], only two retries are possible, butwhenis evaluated three times.This seems different from the global
retry()helper, where thewhencallback is only evaluated after Laravel has determined that another attempt is still available.From an API semantics perspective, I would expect
Http::retry()to behave the same way: evaluatewhenonly when another retry attempt is still available.Is this behavior intentional? If so, I would be curious to understand the reasoning behind it.
All reactions