remove try block from pool request

This commit is contained in:
Alexander Strizhakov 2020-03-03 17:27:56 +03:00
parent aaa879ce75
commit 24bf5c4e89
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
1 changed files with 5 additions and 17 deletions

View File

@ -99,23 +99,11 @@ def request(%Client{} = client, request, %{pool_alive?: false}) do
end end
def request(%Client{} = client, request, %{pool: pool, timeout: timeout}) do def request(%Client{} = client, request, %{pool: pool, timeout: timeout}) do
try do
:poolboy.transaction( :poolboy.transaction(
pool, pool,
&Pleroma.Pool.Request.execute(&1, client, request, timeout), &Pleroma.Pool.Request.execute(&1, client, request, timeout),
timeout timeout
) )
rescue
e ->
{:error, e}
catch
:exit, {:timeout, _} ->
Logger.warn("Receive response from pool failed #{request[:url]}")
{:error, :recv_pool_timeout}
:exit, e ->
{:error, e}
end
end end
@spec request_try(Client.t(), keyword()) :: {:ok, Env.t()} | {:error, any()} @spec request_try(Client.t(), keyword()) :: {:ok, Env.t()} | {:error, any()}