mirror of
https://github.com/benbusby/farside.git
synced 2025-06-08 18:36:36 +00:00
Reuse previous instance within rate-limit interval
Rather than blocking <1s back-to-back queries from the same IP, Farside will now re-use the previously selected instance. Fixes #20
This commit is contained in:
parent
20347822da
commit
22e9135e0c
3 changed files with 20 additions and 11 deletions
|
@ -14,8 +14,7 @@ defmodule Farside.Throttle do
|
|||
def allow_action(conn, _data, _opts), do: conn
|
||||
|
||||
def block_action(conn, _data, _opts) do
|
||||
conn = assign(conn, :throttle, 1)
|
||||
conn
|
||||
|> send_resp(:forbidden, "Exceeded rate limit\n")
|
||||
|> halt
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue