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

feat: support retrying requests when rate limited #707

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Niallfitzy1
Copy link

Fixes: #418

Per the usage limits docs 429s should be handled by retrying, ideally by following an exponential back-off algorithm.

With this PR, you can provide the max retries & retry strategy you'd like to apply when rate limited.

When no configuration is provided, the library will default to the existing behaviour i.e. throw an error.

This is meant as a replacement for PR #525 that's ready to merge & has a more flexible interface for rate limiting.

Copy link
Owner

@theoephraim theoephraim left a comment

Choose a reason for hiding this comment

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

Thanks for this :)

Would be great to have some tests for this, although it is definitely awkward. Would probably have to use nock (or similar) to fake the 429.

src/lib/GoogleSpreadsheet.ts Outdated Show resolved Hide resolved
@Niallfitzy1
Copy link
Author

Would be great to have some tests for this, although it is definitely awkward. Would probably have to use nock (or similar) to fake the 429.

Added unit testing, nock made it quite doable actually, good suggestion!

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.

Check API status / Automated retry logic
2 participants