-
Notifications
You must be signed in to change notification settings - Fork 75
Defaults vs custom values in attribute #6
Comments
Yes setting the defaults to 0 should work, the default values supplied in the constructor applies to actions that don't have the EnableThrottling attribute, or when you've missed to supply a PerFoo rate in the attribute. |
Okay that makes good sense. But what happens, for example, if I want to throttle an action by day. In the attribute, is it enough to specify |
No need to specify those. You need to put the rate types you want to enable in the constructor and use them in attribute. The 0 value should disable the rate limit type, please make a test and let me know. |
"You need to put the rate types you want to enable in the constructor"... I assume you mean the ctor of the global filter. It's for a big project, so we "enabled" all of them to Okay I tested and it seems to work, but we have many places where it's used, and I'm trying to go through many combinations to see what happens. |
It's a pity this isn't on the main docs, so for anybody else who wants to know, here is my understanding:
Please correct anything if it's wrong? I'll update more when I have tested more. |
You are right, this is the intended behavior. I must find a better way to enable/disable limit types.
In the example above, PerHour will get ignored. Thanks for running these tests. |
Oops, so I misunderstood... 😄 In your example I thought the Sorry, I am maybe a bit "slow" (I've been throttled)... I agree we should think what is a good way to handle this use case. Or keep it as it is, but make a "formal" documentation for it... |
I don't understand how the default limits are used.
I always throttle specific actions, using the attribute. I don't do this globally. I want to define custom limits every time I use the attribute e.g.
[EnableThrottling(PerFoo=123)]
.But there are also defaults set in the global filter. I wish I didn't need to specify defaults, but the constructor wants them. Because of this my limits often conflict and I get unexpected results.
So is it safe to do something like this:
...and then set my real values on the attribute? I noticed that some of these override the others.
The text was updated successfully, but these errors were encountered: