forked from PipelineDeals/homework_assignment_2024
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change limit for /companies to 4 from 10 (300ms timeout for fetch)
- Loading branch information
Denis Savitskiy
committed
Apr 24, 2024
1 parent
7d6d7bc
commit 4de85ea
Showing
1 changed file
with
4 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
Rack::Attack.throttle("requests by ip", limit: 5, period: 2) do |request| | ||
request.ip | ||
end | ||
Rack::Attack.throttle('requests by ip', limit: 5, period: 1, &:ip) | ||
|
||
# Throttle query for companies filter to 10 reqs/sec | ||
Rack::Attack.throttle('limit query for companies filter', limit: 10, period: 1) do |request| | ||
if request.path == '/companies' && request.get? | ||
request.ip | ||
end | ||
# Throttle query for companies filter | ||
Rack::Attack.throttle('limit query for companies filter', limit: 4, period: 1) do |request| | ||
request.ip if request.path == '/companies' && request.get? | ||
end |