Exempt initial requests from ratelimits #510
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Potentially fixes an issue where Toolbox would intermittently not load when a page is first loaded.
Adds an additional argument to
Ratelimiter#request
, an options object which influences how the ratelimiter processes the request. The only current option isbypassLimit
, which causes the request to be sent immediately when it is added to the queue, without checking if the current bucket still has requests remaining. This option is passed byTBApi.getJSON
asbypassRatelimit
and is used exclusively by the requests made when Toolbox is first loading in order to prevent them from blocking all of Toolbox.Also includes some light restructuring of the Ratelimiter class - added type annotations to its properties and switched to storing pending requests as objects rather than array. Also added typedefs for the relevant interfaces.
The ESLint
ecmaVersion
bump is compatible with all our supported browsers and allows for the...
spread notation for object properties, which is used here.