mirror of
https://github.com/benbusby/farside.git
synced 2025-05-04 17:40:02 +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
|
@ -40,7 +40,14 @@ defmodule Farside.Router do
|
|||
|
||||
get "/:service/*glob" do
|
||||
path = Enum.join(glob, "/")
|
||||
instance = Farside.pick_instance(service)
|
||||
instance = cond do
|
||||
conn.assigns[:throttle] != nil ->
|
||||
Farside.last_instance(service)
|
||||
true ->
|
||||
Farside.pick_instance(service)
|
||||
end
|
||||
IO.inspect(get_req_header(conn, "throttle"))
|
||||
IO.inspect(instance)
|
||||
|
||||
params =
|
||||
cond do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue