GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Implement retries in the Jetty transporter by sakshichitnis27 · Pull Request #2242 · apache/maven-resolver Conversation
|
| if (retryAfter.contains(":")) { // is date when to retry | ||
| delay = Math.max( | ||
| responseHeaders.getDateField(HttpHeader.RETRY_AFTER) - System.currentTimeMillis(), 0L); | ||
| reason = "Retry-After header with date value " + retryAfter; | ||
| } else { | ||
| delay = Long.parseLong(retryAfter.trim()) * 1000L; // is in seconds | ||
| reason = "Retry-After header with seconds value " + retryAfter; | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
💡 Retry-After heuristic: prefer try-parse-as-long over contains(':').
RFC 7231 defines Retry-After as either a delta-seconds value (all digits) or an HTTP-date (contains :). The current heuristic works for all well-formed values, but the more robust and self-documenting approach is to try parsing as a long first and fall back to date parsing — consistent with the outer catch (IllegalArgumentException) which already covers NumberFormatException.
| if (retryAfter.contains(":")) { // is date when to retry | |
| delay = Math.max( | |
| responseHeaders.getDateField(HttpHeader.RETRY_AFTER) - System.currentTimeMillis(), 0L); | |
| reason = "Retry-After header with date value " + retryAfter; | |
| } else { | |
| delay = Long.parseLong(retryAfter.trim()) * 1000L; // is in seconds | |
| reason = "Retry-After header with seconds value " + retryAfter; | |
| } | |
| try { | |
| long seconds = Long.parseLong(retryAfter.trim()); | |
| delay = seconds * 1000L; // is in seconds | |
| reason = "Retry-After header with seconds value " + retryAfter; | |
| } catch (NumberFormatException nfe) { | |
| // not a delta-seconds value, try parsing as HTTP-date | |
| delay = Math.max( | |
| responseHeaders.getDateField(HttpHeader.RETRY_AFTER) - System.currentTimeMillis(), 0L); | |
| reason = "Retry-After header with date value " + retryAfter; | |
| } |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I kept the contains(":") check so it behaves the same as ApacheTransporter, which tells a date from seconds the same way. Happy to switch to try-parse-first if you'd prefer.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Following up on my earlier review — the resource leak is addressed, and the Retry-After heuristic I flagged is functionally correct.
✅ Addressed: InputStreamResponseListener not closed on exception retry — listener.close() added before continue (commit f3fadbc).
💡 Still open (non-blocking): Retry-After contains(":") heuristic — RFC 7231 guarantees all well-formed values are correctly classified (delta-seconds never contain a colon; HTTP-dates always do). The original suggestion to try parseLong first is stylistic; there's no correctness issue here. Leaving the thread open for the author to address or close at their discretion.
Previous findings resolved. LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Following up on my earlier review — the single commit since my last LGTM (beb12a7) is a test-only change.
✅ testPut_RetriesAfterClosedConnection — removed the file-content assertion after a closed-connection retry sequence. The comment correctly explains the issue: when the server closes the connection immediately (setConnectionsToClose), the handler may have partially executed, potentially leaving the file in an indeterminate state. The assertion was therefore brittle and its removal is correct.
💡 Still open (non-blocking): The Retry-After contains(":") heuristic thread — as noted in my previous review, this is functionally correct per RFC 7231 and the remaining thread is purely stylistic. No action required.
LGTM — ready to merge.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Implement retry handling in Jetty Transporter
There was an error while loading. Please reload this page.