guzzle_retry_middleware
guzzle_retry_middleware copied to clipboard
'retry_on_timeout': false blocks all ConnectException not only timeout
Detailed description
First of all I want to thank you for a great project!
When have set the retry_on_timeout setting to false (default value) it blocks all request resulting in a ConnectException from being retried. This causes confusion when using the library. I have some suggested solutions of varying degree ROI. I can help with the implementation if you want to, just let me know what solution you prefer.
Context
protected function shouldRetryConnectException(array $options, RequestInterface $request): bool
{
return $options['retry_enabled']
&& ($options['retry_on_timeout'] ?? false)
&& $this->hasTimeAvailable($options) !== false
&& $this->countRemainingRetries($options) > 0
&& $this->ensureMethod($options, $request);
}
https://github.com/caseyamcl/guzzle_retry_middleware/blob/v2.9.0/src/GuzzleRetryMiddleware.php#L230-L243
Possible implementation
- Just rename
retry_on_timeouttoretry_on_connection_issuePros: Small amount of work Cons: Require a major version bump which may be a bit aggressive for such a small change - Introduce a new option called
retry_on_connection_issuewith a default value offalseand deprecating theretry_on_timeoutoption. Check if ether one is true when deciding if a retry should be done Pros: Keep backwards compatibility Cons: Require the documentation to be clear in order to avoid confusion
There are more possible solutions, please let me know what you think