Skip to content

Commit 4a9a438

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

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

config/initializers/rack_attack.rb

Lines changed: 3 additions & 7 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: 10, period: 2, &:ip)
42

53
# 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
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)