msgraph-sdk-javascript icon indicating copy to clipboard operation
msgraph-sdk-javascript copied to clipboard

increase default retry delay

Open altano opened this issue 2 years ago • 1 comments

Summary

Creates new defaults for retrying delays:

Thing Old Value New Value Reasoning
DEFAULT_MAX_RETRIES 3 12 2^12 seconds is just over 1 hour, which should be enough for OneNote
MAX_DELAY 180 seconds 3_600 (1 hour) This makes it so that retry 12+ only wait 1 hour between retries instead of continuing to backoff the delay exponentially
MAX_MAX_RETRIES 10 64 This needs to be higher than DEFAULT_MAX_RETRIES but the choice of 64 is arbitrary

Motivation

Some of the graph APIs do not provide the retry-after header in HTTP 429 throttling responses. The default behavior of this SDK is to retry 3 times, with exponential backoff. The problem with this approach is that the max retry of 3 attempts (with a delay of ~8 seconds) just isn't enough for some APIs. For example, OneNote's API will potentially return 429s for 1 hour.

See this GitHub issue for more discussion.

Test plan

I was hoping to write unit tests for this but I can't get the tests to run (https://github.com/microsoftgraph/msgraph-sdk-javascript/issues/1513).

Closing issues

Fixes #978

Types of changes

  • [x] 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

  • [x] I have read the CONTRIBUTING document.
  • [x] 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 added tests to cover my changes.
  • [ ] All new and existing tests passed.

altano avatar Oct 30 '23 02:10 altano

@microsoft-github-policy-service agree

altano avatar Oct 30 '23 02:10 altano