libyear-gradle-plugin icon indicating copy to clipboard operation
libyear-gradle-plugin copied to clipboard

Add retry on server errror 502

Open koppor opened this issue 1 year ago • 2 comments
trafficstars

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.

koppor avatar May 17 '24 08:05 koppor

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 avatar May 19 '24 16:05 f4lco

@f4lco Yeah, I feel confident. I put it on my TODO list after the (unrelated) issue https://github.com/openrewrite/rewrite/issues/4054 :)

koppor avatar May 21 '24 14:05 koppor

+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 avatar Mar 12 '25 20:03 Breefield

@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?

f4lco avatar Mar 12 '25 20:03 f4lco

Oh yes, failOnError already exists.

This would just a be a retry policy with a retry limit.

Breefield avatar Mar 12 '25 21:03 Breefield

https://github.com/f4lco/libyear-gradle-plugin/pull/37

Breefield avatar Mar 15 '25 04:03 Breefield

@f4lco mind reviewing the above PR?

Breefield avatar Mar 31 '25 21:03 Breefield

Fixed with v0.4.0. Thanks a ton @Breefield 🥳

f4lco avatar Apr 08 '25 14:04 f4lco