diff options
Diffstat (limited to 'lib/pleroma/gun')
-rw-r--r-- | lib/pleroma/gun/conn.ex | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/pleroma/gun/conn.ex b/lib/pleroma/gun/conn.ex index de3173351..fb7153a16 100644 --- a/lib/pleroma/gun/conn.ex +++ b/lib/pleroma/gun/conn.ex @@ -34,11 +34,8 @@ defmodule Pleroma.Gun.Conn do crf: 1, retries: 0 - @spec open(String.t() | URI.t(), atom(), keyword()) :: :ok | nil - def open(url, name, opts \\ []) - def open(url, name, opts) when is_binary(url), do: open(URI.parse(url), name, opts) - - def open(%URI{} = uri, name, opts) do + @spec open(URI.t(), atom(), keyword()) :: :ok + def open(%URI{} = uri, name, opts \\ []) do pool_opts = Pleroma.Config.get([:connections_pool], []) opts = @@ -62,7 +59,7 @@ defmodule Pleroma.Gun.Conn do end defp try_open(name, uri, opts, max_connections) do - if Connections.count(name) < max_connections do + if Connections.count(name) <= max_connections do do_open(uri, opts) else close_least_used_and_do_open(name, uri, opts) |