From fec966ae59af3de1d1098ca11192041402c039cb Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Fri, 12 Nov 2021 14:40:05 -0700 Subject: [PATCH] Fix formatting --- lib/farside/throttle.ex | 6 ++++-- mix.exs | 2 +- test/farside_test.exs | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/farside/throttle.ex b/lib/farside/throttle.ex index fc8b591..8bbf54c 100644 --- a/lib/farside/throttle.ex +++ b/lib/farside/throttle.ex @@ -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 diff --git a/mix.exs b/mix.exs index f6f91cd..6b9f512 100644 --- a/mix.exs +++ b/mix.exs @@ -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 diff --git a/test/farside_test.exs b/test/farside_test.exs index a64a389..d508b27 100644 --- a/test/farside_test.exs +++ b/test/farside_test.exs @@ -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