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

Implement standard retry policies for failed API requests #183

Open
anikitin opened this issue Apr 29, 2022 · 2 comments
Open

Implement standard retry policies for failed API requests #183

anikitin opened this issue Apr 29, 2022 · 2 comments

Comments

@anikitin
Copy link

anikitin commented Apr 29, 2022

It seems that SDK supports one-time retry out of the box for failed requests. We need to support more sophisticated policies, especially for internal clients. I suggest to implement the following policy as a default retry policy:

  • For HTTP 4xx errors (except HTTP 429) no retries are made
  • For 429 and 5xx
    • Exponential backoff policy with jitter
    • Initial retry interval is configured: default = minimum = 1 second)
    • Number of retries is configured: minimum = 0, default = 3 retries, maximum should be limited, e.g. 20)
    • Jitter randomization factor is configured: minimum = 0 (no jitter), default = 0.3, maximum =0.5
    • If "Retry-After" header is returned by backend it has to be obeyed (current retry interval must NEVER be less than returned "Retry-After")

Client can define global policy or customize per API call.
SHould be eventually added to other SDKs as well.

See also:

@tylerlong
Copy link
Contributor

@embbnux Could you please add some comments about how integration team handles 429 issue in some of the popular production integration apps? We would like to take advantages of your experience. Thanks.

@embbnux
Copy link
Contributor

embbnux commented May 5, 2022

The JS widget lib listen to 429 error, and show a message about the error to user with a time counter (from Retry-After) in UI. After time go to zero, it will request the API again.
https://github.com/ringcentral/ringcentral-js-widgets/blob/master/packages/ringcentral-integration/modules/RateLimiterV2/RateLimiter.ts#L113

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

No branches or pull requests

3 participants