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

[API Proposal]: System.Threading.RateLimiting.RateLimiter.AcquireAsync(CancellationToken cancellationToken); #101793

Open
TonyValenti opened this issue May 2, 2024 · 1 comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Threading untriaged New issue has not been triaged by the area owner

Comments

@TonyValenti
Copy link

Background and motivation

Acquiring one permit from a rate limiter and using a cancelation token is a common scenario. This should be built in to the core

API Proposal

namespace System.Threading.RateLimiting;

public class RateLimiter
{
    public ValueTask<RateLimitLease> AcquireAsync(CancellationToken cancellationToken);
}

API Usage

using var Lease = await RateLimiter.AcquireAsync(Token);

Alternative Designs

This could be implemented as an extension method.

Risks

No response

@TonyValenti TonyValenti added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label May 2, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label May 2, 2024
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Threading untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

1 participant