Fix formatting

This commit is contained in:
Ben Busby 2021-11-12 14:40:05 -07:00
parent 3181bdfc80
commit fec966ae59
No known key found for this signature in database
GPG Key ID: 339B7B7EB5333D14
3 changed files with 8 additions and 5 deletions

View File

@ -4,9 +4,11 @@ defmodule Farside.Throttle do
rule "throttle per ip", conn do
# throttle to 1 request per second
throttle conn.remote_ip,
period: 1_000, limit: 1,
throttle(conn.remote_ip,
period: 1_000,
limit: 1,
storage: {PlugAttack.Storage.Ets, Farside.Throttle.Storage}
)
end
def allow_action(conn, _data, _opts), do: conn

View File

@ -27,7 +27,7 @@ defmodule Farside.MixProject do
{:plug_attack, "~> 0.4.2"},
{:plug_cowboy, "~> 2.0"},
{:poison, "~> 5.0"},
{:redix, "~> 1.1"},
{:redix, "~> 1.1"}
]
end
end

View File

@ -10,9 +10,10 @@ defmodule FarsideTest do
def test_conn(path) do
:timer.sleep(1000)
:get
|> conn(path, "")
|> Router.call(@opts)
|> conn(path, "")
|> Router.call(@opts)
end
test "throttle" do