Conversation
|
Thanks for the pull request. I'm not sure about a global throttling capability since the purpose of this gem was really to allow "per endpoint" throttling capability. |
|
It's isn't on by default, it's opt in on both the app and individual endpoint levels, (i.e. if I wan't endpoint A and B to contribute to the same total). No hard feelings if this doesn't get merged in just thought I would spend a couple of minutes knocking this up as it was something I was looking for when looking to use this gem. |
|
Maybe we should allow to customize the key used to track stats per endpoints. This way, one could do something like this: Grape::Attack.configure do |config|
config.max = 1000
config.per = 1.day
endand on each endpoints: throttle key: "my_app"
get 'foo' do
...
end |
|
Yeah I like that a lot more than the way I implemented it. It gives you the option to group endpoints in any way you want |
Adapted from gottfrois#7
Allow users to specify
global_throttling, meaning all requests from an identifier to an endpoint withglobal_throttlingenabled contribute toward theglobal_throttling_max.Useful for app-wide throttling