libyear-gradle-plugin
libyear-gradle-plugin copied to clipboard
Add retry on server errror 502
In case of large projects, maven central response with 502.
See https://github.com/koppor/jabref/pull/686 for a non-MWE.
Cannot determine dependency age for "com.vladsch.flexmark:flexmark-util-html:0.64.8" and repository "MavenRepo" (reason: IOException: Response for URL https://search.maven.org/solrsearch/select?q=g%3A%22com.vladsch.flexmark%22%20AND%20a%3A%22flexmark-util-html%22 returned 502).
I think, a "simply" retry after 3 seconds should be done in the case if 502 is returned.
Hello @koppor, thank you for your feedback. This project is accepting contributions, and your suggestion seems worthwhile. Would you feel confident implementing a retry for a status code of 502?
@f4lco Yeah, I feel confident. I put it on my TODO list after the (unrelated) issue https://github.com/openrewrite/rewrite/issues/4054 :)
+1 to this, I'm about to introduce this.
Would folks prefer an exponential backoff retry with total timeout, or just fail the entire report if 1x 502 surfaces?
I notice the 502s are not consistent and sometimes Maven is more agro than other times.
@Breefield not sure if I get the question correct, let me put my 2ct that way: I think the point is to retry the same request for the same dependency at all. I'd assume a fixed delay ("after x seconds") is fine, because we want to mitigate the effects of an unreliable network or server. If we wanted to get around a rate limiter, we needed to find another way to throttle the requests or cache more aggressively.
Regarding the failure mode: I think the plugin already has the failOnError switch, which we can put to use:
- on
failOnError = false, we activate "best effort mode", log the terminally failed request, and move on - on
failOnError = true, the entire report fails when all requests for a particular dependency have failed
@koppor what do you think?
Oh yes, failOnError already exists.
This would just a be a retry policy with a retry limit.
https://github.com/f4lco/libyear-gradle-plugin/pull/37
@f4lco mind reviewing the above PR?
Fixed with v0.4.0. Thanks a ton @Breefield 🥳