kwin commented on code in PR #2236:
URL: https://github.com/apache/maven-resolver/pull/2236#discussion_r4388729751


##########
maven-resolver-transport-apache/src/main/java/org/eclipse/aether/transport/apache/ApacheTransporter.java:
##########
@@ -822,28 +856,50 @@ public boolean retryRequest(HttpResponse response, int 
executionCount, HttpConte
          */
         private Long retryInterval(HttpResponse httpResponse, int 
executionCount, HttpContext httpContext) {
             Long result = null;
+            String intervalReason = "";
             Header header = 
httpResponse.getFirstHeader(HttpHeaders.RETRY_AFTER);
             if (header != null && header.getValue() != null) {
                 String headerValue = header.getValue();
                 if (headerValue.contains(":")) { // is date when to retry
                     Date when = DateUtils.parseDate(headerValue); // 
presumably future
                     if (when != null) {
                         result = Math.max(when.getTime() - 
System.currentTimeMillis(), 0L);
+                        intervalReason = "Retry-After header with date value " 
+ headerValue;
+                    } else {
+                        LOGGER.warn(
+                                "Invalid Retry-After header value {} for 
request to {}",
+                                headerValue,
+                                
httpContext.getAttribute(HttpCoreContext.HTTP_TARGET_HOST));
                     }
                 } else {
                     try {
                         result = Long.parseLong(headerValue) * 1000L; // is in 
seconds
+                        intervalReason = "Retry-After header with seconds 
value " + headerValue;
                     } catch (NumberFormatException e) {
                         // fall through
+                        LOGGER.warn(
+                                "Invalid Retry-After header value {} for 
request to {}",
+                                headerValue,
+                                
httpContext.getAttribute(HttpCoreContext.HTTP_TARGET_HOST));
                     }
                 }
             }
             if (result == null) {
                 result = executionCount * this.retryInterval;
+                intervalReason =
+                        "retryInterval " + this.retryInterval + " ms 
multiplied by execution count " + executionCount;
             }
             if (result > retryIntervalMax) {
-                return null;
+                intervalReason += ", capped at max value";
+                result = retryIntervalMax;
             }

Review Comment:
   Fixed PR description accordingly.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to