Skip to content

Commit 4de85ea

Browse files
author
Denis Savitskiy
committed
Change limit for /companies to 4 from 10 (300ms timeout for fetch)
1 parent 7d6d7bc commit 4de85ea

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

config/initializers/rack_attack.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
Rack::Attack.throttle("requests by ip", limit: 5, period: 2) do |request|
2-
request.ip
3-
end
1+
Rack::Attack.throttle('requests by ip', limit: 5, period: 1, &:ip)
42

5-
# Throttle query for companies filter to 10 reqs/sec
6-
Rack::Attack.throttle('limit query for companies filter', limit: 10, period: 1) do |request|
7-
if request.path == '/companies' && request.get?
8-
request.ip
9-
end
3+
# Throttle query for companies filter
4+
Rack::Attack.throttle('limit query for companies filter', limit: 4, period: 1) do |request|
5+
request.ip if request.path == '/companies' && request.get?
106
end

0 commit comments

Comments
 (0)