Request limits middleware PoC #32886
Conversation
7130ee3
to
9d02c46
|
||
namespace RequestLimiterSample | ||
{ | ||
[RequestLimit(requestPerSecond: 10)] |
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.
It's unlikely this would ever be hardcoded, I wonder how useful this is as an attribute. Maybe we need it for completeness.
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?
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?
davidfowl
May 21, 2021
Contributor
I mean read from configuration and set based on the environment
I mean read from configuration and set based on the environment
JunTaoLuo
May 21, 2021
Author
Contributor
Ah yes, config driven limits. I haven't implemented that part yet.
Ah yes, config driven limits. I haven't implemented that part yet.
private readonly long _newResourcePerSecond; | ||
|
||
private Timer _renewTimer; | ||
// This is racy |
davidfowl
May 21, 2021
Contributor
yes
yes
41d5bb4
to
52e0b9c
TODO: