'retry_on_timeout': false blocks all ConnectException not only timeout
ViktorCollin opened this issue · comments
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);
}
Possible implementation
- Just rename
retry_on_timeout
toretry_on_connection_issue
Pros: 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_issue
with a default value offalse
and deprecating theretry_on_timeout
option. 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