Skip to content

[API Proposal]: AggregateRateLimiter #98017

@TonyValenti

Description

@TonyValenti

Background and motivation

It would be nice to be able to AND (and possibly OR) rate limiters together.

For example, "I want a rate limiter that allows no more than 10 requests per second and no more than 2 concurrent requsts".

API Proposal

namespace System.Threading.RateLimiting;

public class AggregateRateLimiter : RateLimiter
{
  public AggregateRateLimiter(IEnumerable<RateLimiter> Children);
}

API Usage

var Limiter1 = ...;
var Limiter2 = ...;
var Limiter = new AggregateRateLimiter([Limit1, Limit2]);

Alternative Designs

People can always roll their own.

Risks

None that I can think of.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-approvedAPI was approved in API review, it can be implementedarea-System.Threadingin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions