ConnectionPool.Worker: do not stop with an error when there is a timeout

This produced error log messages about GenServer termination
every time the connection was not open due to a timeout.

Instead we stop with `{:shutdown, <gun_error>}` since shutting down
when the connection can't be established is normal behavior.
This commit is contained in:
rinpatch 2020-07-15 15:58:08 +03:00
parent 6d583bcc3b
commit 7115c5f82e
2 changed files with 5 additions and 2 deletions

View file

@ -53,7 +53,10 @@ defmodule Pleroma.Gun.ConnectionPool do
{:ok, pid} {:ok, pid}
{:DOWN, ^ref, :process, ^worker_pid, reason} -> {:DOWN, ^ref, :process, ^worker_pid, reason} ->
{:error, reason} case reason do
{:shutdown, error} -> error
_ -> {:error, reason}
end
end end
end end

View file

@ -31,7 +31,7 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do
:hibernate} :hibernate}
else else
err -> err ->
{:stop, err, nil} {:stop, {:shutdown, err}, nil}
end end
end end