Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-150: adjust feign retryer configuration (#151) #215

Merged
merged 2 commits into from
Feb 12, 2024
Merged

GH-150: adjust feign retryer configuration (#151) #215

merged 2 commits into from
Feb 12, 2024

Conversation

francoisledroff
Copy link
Collaborator

Description

Configure Retries in Feign utility:

  • retry calls maximum 3 times (5 before)
  • enlarge the maximum waiting period to 4s (1s before)
  • use a larger base interval of 1s (100ms before)

Related Issue

#150
#151

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: #149

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Co-authored-by: Nicola Dardanis <ndardanis@adobe.com>
@@ -41,6 +44,7 @@ public static Feign.Builder getBaseBuilder() {
.logLevel(Level.NONE)
//.logLevel(Level.FULL) // use this instead when debugging
.decode404()
.retryer(new Retryer.Default(1000, SECONDS.toMillis(4), 3))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you think we should allow the users to specify the retries through conf here ?
same as for the log level see #146

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done :)

@nicdard nicdard merged commit 4437be4 into main Feb 12, 2024
5 checks passed
@nicdard nicdard deleted the GH-150 branch February 12, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants