-
Notifications
You must be signed in to change notification settings - Fork 62
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: throttle getAll* methods and rename getAll to dangerouslyGetAll #193
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job! I just think there are some minor tweaks to be made but I really like the approach you took to throttle that neatly when in ideal conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with it as-is. Just to make sure I got it right:
getAll
is nowdangerouslyGetAll
;- A 500ms delay between each request is added;
- That's it(?)
Yep, that's right! I edited the original comment to reflect the latest simplifications. If that's good with you, I'll merge it and publish in a new beta version (along with #196). |
Yup, good for me! @srenault is it a green light for you also? If yes, we'll proceed to update the documentation and bring to the user more consideration before they start using these methods. |
This was approved by @srenault outside GitHub. 🎉 |
Types of changes
Description
This adds throttle-like behavior to all
getAll*
methods.500ms
is used as the duration between network requests.This ensures API performance is sustainable even with large queries.
getAll*
methods should be treated as long-running requests that may make multiple network requests in a safe timely manner.The following algorithm is used:
Query for a page of results.
If the result tells us there are additional pages:
If there are no additional pages:
For example, with a 3 page query:
With a 1 page query:
This PR also renames
getAll
todangerouslyGetAll
to dissuade usage.Checklist:
🐢