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

TokenBucketRateLimiter implementation #390

Merged
merged 9 commits into from
Nov 11, 2021
Merged

Conversation

BrennanConroy
Copy link
Member

Depends on #387 so there aren't two PRs adding the test infra/csproj properties.

#pragma warning disable 1591
/// <summary>
/// <see cref="RateLimiter"/> implementation that replenishes tokens periodically instead of via a release mechanism.
/// </summary>
public sealed class TokenBucketRateLimiter : RateLimiter
Copy link
Member

Choose a reason for hiding this comment

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

Should this be disposable because of the _renewTimer? Even if AutoReplenishment is disabled, we probably would want to cancel all queued acquisition request because I doubt anyone will be calling TryReplenish() after disposal and we'll want to cancel all the Tasks and dispose all the CancellationTokenRegistrations.

Base automatically changed from brecon/concurrencylimiter to main October 26, 2021 20:02
Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

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

Let's file an issue for making rate limiters disposable.

@BrennanConroy BrennanConroy merged commit df6e3f6 into main Nov 11, 2021
@BrennanConroy BrennanConroy deleted the brecon/tokenlimiter branch November 11, 2021 21:52
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.

2 participants