Skip to content

Commit

Permalink
Change limit for /companies to 4 from 10 (300ms timeout for fetch)
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Savitskiy committed Apr 24, 2024
1 parent 7d6d7bc commit 72d2c28
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions config/initializers/rack_attack.rb
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: 2, &: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
Rack::Attack.throttle('limit query for companies filter', limit: 4, period: 1) do |request|
request.ip if request.path == '/companies' && request.get?
end

0 comments on commit 72d2c28

Please sign in to comment.