adobe / aio-lib-java

Adobe I/O - Java SDK
https://opensource.adobe.com/aio-lib-java/
Apache License 2.0
6 stars 19 forks source link

GH-150: adjust feign retryer configuration #151

Closed nicdard closed 9 months ago

nicdard commented 1 year ago

Description

Configure Retries in Feign utility:

Related Issue

150

Motivation and Context

This would better tune calls retries. We do not want in general to retry too much, and we want more time between each of the calls to wait for the called system to recover. Note that even in case of a retry after header present in the response, the maximum waiting period will be used in place of the time specified in the response to place the next call when lower:

 if (e.retryAfter() != null) {
        interval = e.retryAfter().getTime() - currentTimeMillis();
        if (interval > maxPeriod) {
          interval = maxPeriod;
        }

which is ok to protect the service for hanging up for too long. 4s seems like a reasonable time to wait before retrying and eventually fail, also, the maximal waiting period that can be calculated with the given parameters by the exponential backoff strategy fits the maximum as well.

Another solution would be the approach proposed here: https://github.com/adobe/aio-lib-java/pull/149

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

Checklist:

francoisledroff commented 9 months ago

merged this to GH-150: next step https://github.com/adobe/aio-lib-java/pull/215