@ -5,6 +5,8 @@
defmodule Pleroma.ReverseProxy.Client.Tesla do
@behaviour Pleroma.ReverseProxy.Client
alias Pleroma.Gun.ConnectionPool
@type headers ( ) :: [ { String . t ( ) , String . t ( ) } ]
@type status ( ) :: pos_integer ( )
@ -31,6 +33,8 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
if is_map ( response . body ) and method != :head do
{ :ok , response . status , response . headers , response . body }
else
conn_pid = response . opts [ :adapter ] [ :conn ]
ConnectionPool . release_conn ( conn_pid )
{ :ok , response . status , response . headers }
end
else
@ -48,7 +52,7 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
# if there were redirects we need to checkout old conn
conn = opts [ :old_conn ] || opts [ :conn ]
if conn , do : :ok = Pleroma.Gun. ConnectionPool. release_conn ( conn )
if conn , do : :ok = ConnectionPool. release_conn ( conn )
:done
end
@ -74,8 +78,7 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
@impl true
@spec close ( map ) :: :ok | no_return ( )
def close ( %{ pid : pid } ) do
adapter = check_adapter ( )
adapter . close ( pid )
ConnectionPool . release_conn ( pid )
end
defp check_adapter do