- @spec stream_body(map()) :: {:ok, binary(), map()} | {:error, atom() | String.t()} | :done
- def stream_body(%{pid: pid, opts: opts, fin: true}) do
- # if connection was sended and there were redirects, we need to close new conn - pid 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 = Pleroma.Pool.Connections.checkout(conn, self(), :gun_connections)
-
+ @spec stream_body(map()) ::
+ {:ok, binary(), map()} | {:error, atom() | String.t()} | :done | no_return()
+ def stream_body(%{pid: pid, fin: true}) do
+ ConnectionPool.release_conn(pid)