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 @@ defp get_gun_pid_from_worker(worker_pid, register) do
{:ok, pid}
{:DOWN, ^ref, :process, ^worker_pid, reason} ->
{:error, reason}
case reason do
{:shutdown, error} -> error
_ -> {:error, reason}
end
end
end

View File

@ -31,7 +31,7 @@ def handle_continue({:connect, [key, uri, opts, client_pid]}, _) do
:hibernate}
else
err ->
{:stop, err, nil}
{:stop, {:shutdown, err}, nil}
end
end