arturobernalg commented on PR #672:
URL: 
https://github.com/apache/httpcomponents-client/pull/672#issuecomment-3045926233

   @ok2c 
   
   In the `retryRequest(HttpResponse, int, HttpContext)` method, the code 
checks `defaultRetryInterval` against the `responseTimeout` to prevent retries 
that would exceed the timeout. However, since `getRetryInterval` can return a 
dynamic interval based on `the Retry-After` header (as noted in the Javadoc: 
“the default retry interval between subsequent retries if the Retry-After 
header is not set or invalid”), it’s possible for the actual retry delay to 
exceed `responseTimeout` if Retry-After specifies a larger value. For example, 
if `defaultRetryInterval` is 1 second, `responseTimeout` is 3 seconds, and 
`Retry-After` is 5 seconds, the check allows a retry, but the 5-second delay 
violates the timeout. 
   I wonder if it would make sense to call getRetryInterval in retryRequest to 
compare the actual retry interval against responseTimeout, ???  That make 
sense?? 
   
   
   ```
   if (context != null) {
       final HttpClientContext clientContext = HttpClientContext.cast(context);
       final RequestConfig requestConfig = 
clientContext.getRequestConfigOrDefault();
       final Timeout responseTimeout = requestConfig.getResponseTimeout();
       if (responseTimeout != null) {
           final TimeValue retryInterval = getRetryInterval(response, 
execCount, context);
           if (TimeValue.isPositive(retryInterval) && 
retryInterval.compareTo(responseTimeout) > 0) {
               return false;
           }
       }
   }
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to