-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
RateLimiter.withCost
combinator + Rate Limiter composition tests
#2090
Conversation
🦋 Changeset detectedLatest commit: 9a30aae The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ab67624
to
b2b06ad
Compare
RateLimiter
: Sub-constructor to customize cost
+ Rate Limiter composition testsRateLimiter.withCost
combinator + Rate Limiter composition tests
This patch updates the `RateLimiter` to allow setting a custom cost per effect. - Additional tests covering new logic. - Tests to verify composition of rate limiters. - Updated documentation.
497c4de
to
b414c92
Compare
No problem. I did notice that when the implementation was changed but didn't look into it too deeply. |
Depends on #2097 |
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 think we should merge this first, as the other PR will need to add more tests to make sure cost
is well supported.
Type
Description
This patch updates the
RateLimiter
module to include another constructor which includes a sub-constructor which allows us to specify a cost while maintaining composability with otherRateLimiter
instances. This enables the use of this module to rate limit for the following cases :Accessing resources with an "API Credit" limit over a time window.
With composition, accounting for multiple "credit" limits. ( eg: Github API )
Accounting for different "costs" per api per provider within a single credit limit.
Usage Example