forked from AkkomaGang/akkoma
no try block in checkout connection
This commit is contained in:
parent
3723d72365
commit
1ad34bfdba
1 changed files with 9 additions and 44 deletions
|
@ -86,7 +86,6 @@ defp maybe_get_conn(adapter_opts, uri, connection_opts) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp try_to_get_conn(uri, opts) do
|
defp try_to_get_conn(uri, opts) do
|
||||||
try do
|
|
||||||
case Connections.checkin(uri, :gun_connections) do
|
case Connections.checkin(uri, :gun_connections) do
|
||||||
nil ->
|
nil ->
|
||||||
Logger.debug(
|
Logger.debug(
|
||||||
|
@ -103,40 +102,6 @@ defp try_to_get_conn(uri, opts) do
|
||||||
|> Keyword.put(:conn, conn)
|
|> Keyword.put(:conn, conn)
|
||||||
|> Keyword.put(:close_conn, false)
|
|> Keyword.put(:close_conn, false)
|
||||||
end
|
end
|
||||||
rescue
|
|
||||||
error ->
|
|
||||||
Logger.warn(
|
|
||||||
"Gun connections pool checkin caused error #{Connections.compose_uri_log(uri)} #{
|
|
||||||
inspect(error)
|
|
||||||
}"
|
|
||||||
)
|
|
||||||
|
|
||||||
opts
|
|
||||||
catch
|
|
||||||
# TODO: here must be no timeouts
|
|
||||||
:exit, {:timeout, {_, operation, [_, {method, _}, _]}} ->
|
|
||||||
{:message_queue_len, messages_len} =
|
|
||||||
:gun_connections
|
|
||||||
|> Process.whereis()
|
|
||||||
|> Process.info(:message_queue_len)
|
|
||||||
|
|
||||||
Logger.warn(
|
|
||||||
"Gun connections pool checkin with timeout error for #{operation} #{method} #{
|
|
||||||
Connections.compose_uri_log(uri)
|
|
||||||
}. Messages length: #{messages_len}"
|
|
||||||
)
|
|
||||||
|
|
||||||
opts
|
|
||||||
|
|
||||||
:exit, error ->
|
|
||||||
Logger.warn(
|
|
||||||
"Gun pool checkin exited with error #{Connections.compose_uri_log(uri)} #{
|
|
||||||
inspect(error)
|
|
||||||
}"
|
|
||||||
)
|
|
||||||
|
|
||||||
opts
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec format_host(String.t()) :: charlist()
|
@spec format_host(String.t()) :: charlist()
|
||||||
|
|
Loading…
Reference in a new issue