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

.NET 7 RC1 improvements to Rate limiting middleware #45

Closed
Rick-Anderson opened this issue Sep 14, 2022 · 5 comments
Closed

.NET 7 RC1 improvements to Rate limiting middleware #45

Rick-Anderson opened this issue Sep 14, 2022 · 5 comments

Comments

@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Sep 14, 2022

Rate limiting middleware improvements

  • Code to update
  • Add [EnableRateLimitingAttribute("MyControllerPolicy")] to Home2Controller
  • disable rate limiting on a specific endpoint within that group
  • apply policies directly to endpoints.
  • add an instance of it directly to an endpoint
  • Add
builder.Services.AddRateLimiter(options =>
{
   options.AddTokenBucketLimiter("MyControllerPolicy", options =>
   {
       options.TokenLimit = 1;
       options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst;
       options.QueueLimit = 1;
       options.ReplenishmentPeriod = TimeSpan.FromSeconds(10);
       options.TokensPerPeriod = 1;
   })
   .AddPolicy<string>("MyGroupPolicy", new MyRateLimiterPolicy());
});

Then @Rick-Anderson can update Rate limiting middleware in ASP.NET Core

@Kahbazi can you do these updates?

Also, the updates requested in #14

@Rick-Anderson
Copy link
Contributor Author

@fiyazbinhasan @sammychinedu2ky anyone want to update this sample code for RC1?

@Rick-Anderson
Copy link
Contributor Author

@maartenba would you be able to update the Code . I'll put you on the authors list of Rate limiting middleware in ASP.NET Core

@sammychinedu2ky
Copy link
Contributor

@fiyazbinhasan @sammychinedu2ky anyone want to update this sample code for RC1?

sorry missed this

@maartenba
Copy link
Contributor

Here you go folks - #82

@Rick-Anderson
Copy link
Contributor Author

Fixed in #82

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

No branches or pull requests

3 participants