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

Add request to max_per_window method #36

Merged
merged 3 commits into from Feb 8, 2017
Merged

Conversation

TheWudu
Copy link
Contributor

@TheWudu TheWudu commented Feb 3, 2017

This would enable to override the max_per_<period> method with something request specific.

E.g. check request.request_method to allow 100 GET but only 10 POST requests. (see tests)

README.md Outdated
@@ -132,6 +132,27 @@ significantly more complex than what we've provided for, you can also define
entirely new kinds of throttling strategies by subclassing the
`Rack::Throttle::Limiter` base class directly.

### Example

Customize the max\_per\_second to be different depending on the request's method.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) Can you change:

max\_per\_second

to

`max_per_second`

@FreekingDean
Copy link
Collaborator

Just running some benchmarks to make sure that we don't add too much time to each request :)

@FreekingDean
Copy link
Collaborator

Looks good to me. I'm going to merge this later today!

@FreekingDean FreekingDean merged commit dd2abe0 into dryruby:master Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants