ReverseProxy tesla client: remove handling of old_conn
This is no longer relevant because we use a custom FollowRedirects middleware now
This commit is contained in:
parent
d4fbec62a3
commit
6bf8eee5f9
@ -45,15 +45,8 @@ def request(method, url, headers, body, opts \\ []) do
|
|||||||
@impl true
|
@impl true
|
||||||
@spec stream_body(map()) ::
|
@spec stream_body(map()) ::
|
||||||
{:ok, binary(), map()} | {:error, atom() | String.t()} | :done | no_return()
|
{:ok, binary(), map()} | {:error, atom() | String.t()} | :done | no_return()
|
||||||
def stream_body(%{pid: pid, opts: opts, fin: true}) do
|
def stream_body(%{pid: pid, fin: true}) do
|
||||||
# if connection was reused, but in tesla were redirects,
|
ConnectionPool.release_conn(pid)
|
||||||
# tesla returns new opened connection, which must be closed manually
|
|
||||||
if opts[:old_conn], do: Tesla.Adapter.Gun.close(pid)
|
|
||||||
# if there were redirects we need to checkout old conn
|
|
||||||
conn = opts[:old_conn] || opts[:conn]
|
|
||||||
|
|
||||||
if conn, do: :ok = ConnectionPool.release_conn(conn)
|
|
||||||
|
|
||||||
:done
|
:done
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user