The Wayback Machine - https://web.archive.org/web/20210522173258/https://github.com/dotnet/aspnetcore/pull/32886
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

Request limits middleware PoC #32886

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

@JunTaoLuo
Copy link
Contributor

@JunTaoLuo JunTaoLuo commented May 20, 2021

TODO:

  • Smoke testing
  • Review API
  • Add tests
  • PR (implementation) review
@JunTaoLuo JunTaoLuo force-pushed the johluo/request-limits-middleware branch from 7130ee3 to 9d02c46 May 20, 2021

namespace RequestLimiterSample
{
[RequestLimit(requestPerSecond: 10)]

This comment has been minimized.

@davidfowl

davidfowl May 21, 2021
Contributor

It's unlikely this would ever be hardcoded, I wonder how useful this is as an attribute. Maybe we need it for completeness.

This comment has been minimized.

@JunTaoLuo

JunTaoLuo May 21, 2021
Author Contributor

What do you mean hardcoded? I think it's probably useful to provide a default implementation that takes in common parameters such as "x request per second" since it's super easy to use. Otherwise, requiring the configuration of policies in ConfigureServices and specifying a policy name here may be overly complicated?

This comment has been minimized.

@davidfowl

davidfowl May 21, 2021
Contributor

I mean read from configuration and set based on the environment

This comment has been minimized.

@JunTaoLuo

JunTaoLuo May 21, 2021
Author Contributor

Ah yes, config driven limits. I haven't implemented that part yet.

private readonly long _newResourcePerSecond;

private Timer _renewTimer;
// This is racy

This comment has been minimized.

@davidfowl

davidfowl May 21, 2021
Contributor

yes

@JunTaoLuo JunTaoLuo force-pushed the johluo/request-limits-middleware branch from 41d5bb4 to 52e0b9c May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants