aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-03 17:44:04 +0300
committerAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-03 17:44:04 +0300
commit1ad34bfdbaee7d98167dc7dc7be8b65fd5e6c5f1 (patch)
tree4f58d8a006fa93830b38ef18c5f2aca007d8fdb1
parent3723d723652b747b00fc26054101c15e39a5af18 (diff)
downloadpleroma-1ad34bfdbaee7d98167dc7dc7be8b65fd5e6c5f1.tar.gz
no try block in checkout connection
-rw-r--r--lib/pleroma/http/adapter/gun.ex53
1 files changed, 9 insertions, 44 deletions
diff --git a/lib/pleroma/http/adapter/gun.ex b/lib/pleroma/http/adapter/gun.ex
index 5e88786bd..30c5c3c16 100644
--- a/lib/pleroma/http/adapter/gun.ex
+++ b/lib/pleroma/http/adapter/gun.ex
@@ -86,56 +86,21 @@ defmodule Pleroma.HTTP.Adapter.Gun do
end
defp try_to_get_conn(uri, opts) do
- try do
- case Connections.checkin(uri, :gun_connections) do
- nil ->
- Logger.debug(
- "Gun connections pool checkin was not successful. Trying to open conn for next request."
- )
-
- Task.start(fn -> Pleroma.Gun.Conn.open(uri, :gun_connections, opts) end)
- opts
-
- conn when is_pid(conn) ->
- Logger.debug("received conn #{inspect(conn)} #{Connections.compose_uri_log(uri)}")
-
- opts
- |> Keyword.put(:conn, conn)
- |> Keyword.put(:close_conn, false)
- end
- rescue
- error ->
- Logger.warn(
- "Gun connections pool checkin caused error #{Connections.compose_uri_log(uri)} #{
- inspect(error)
- }"
+ case Connections.checkin(uri, :gun_connections) do
+ nil ->
+ Logger.debug(
+ "Gun connections pool checkin was not successful. Trying to open conn for next request."
)
+ Task.start(fn -> Pleroma.Gun.Conn.open(uri, :gun_connections, opts) end)
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)
- }"
- )
+ conn when is_pid(conn) ->
+ Logger.debug("received conn #{inspect(conn)} #{Connections.compose_uri_log(uri)}")
opts
+ |> Keyword.put(:conn, conn)
+ |> Keyword.put(:close_conn, false)
end
end