Skip to content

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

Merged
nicdard merged 2 commits intomainfrom
GH-150
Feb 12, 2024
Merged

GH-150: adjust feign retryer configuration (#151)#215
nicdard merged 2 commits intomainfrom
GH-150

Conversation

@francoisledroff
Copy link
Copy Markdown
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>
.logLevel(Level.NONE)
//.logLevel(Level.FULL) // use this instead when debugging
.decode404()
.retryer(new Retryer.Default(1000, SECONDS.toMillis(4), 3))
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

done :)

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