connect_timeout: 20_000,
domain_lookup_timeout: 5_000,
tls_handshake_timeout: 5_000,
- retry_timeout: 100,
+ retry: 0,
await_up_timeout: 5_000
]
try do
case Connections.checkin(uri, :gun_connections) do
nil ->
- Logger.info(
+ Logger.debug(
"Gun connections pool checkin was not successful. Trying to open conn for next request."
)
opts
conn when is_pid(conn) ->
- Logger.debug("received conn #{inspect(conn)} #{Connections.compose_uri(uri)}")
+ Logger.debug(
+ "received conn #{inspect(conn)} #{uri.scheme}://#{Connections.compose_uri(uri)}"
+ )
opts
|> Keyword.put(:conn, conn)
end
rescue
error ->
- Logger.warn("Gun connections pool checkin caused error #{inspect(error)}")
+ Logger.warn(
+ "Gun connections pool checkin caused error #{uri.scheme}://#{
+ Connections.compose_uri(uri)
+ } #{inspect(error)}"
+ )
+
opts
catch
- :exit, {:timeout, _} ->
- Logger.info(
- "Gun connections pool checkin with timeout error #{Connections.compose_uri(uri)}"
+ :exit, {:timeout, {_, operation, [_, {method, _}, _]}} ->
+ messages_len =
+ :gun_connections
+ |> Process.whereis()
+ |> Process.info(:message_queue_len)
+
+ Logger.warn(
+ "Gun connections pool checkin with timeout error for #{operation} #{method} #{
+ uri.scheme
+ }://#{Connections.compose_uri(uri)}. Messages length: #{messages_len}"
)
opts
:exit, error ->
- Logger.warn("Gun pool checkin exited with error #{inspect(error)}")
+ Logger.warn(
+ "Gun pool checkin exited with error #{uri.scheme}://#{Connections.compose_uri(uri)} #{
+ inspect(error)
+ }"
+ )
+
opts
end
end