mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 03:17:51 +00:00
Add diagnostics http
This commit is contained in:
parent
9d9c26b833
commit
e6da301296
2 changed files with 9 additions and 6 deletions
|
@ -9,6 +9,13 @@ defmodule Mix.Tasks.Pleroma.Diagnostics do
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
|
def run(["http", url]) do
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
Pleroma.HTTP.get(url)
|
||||||
|
|> IO.inspect()
|
||||||
|
end
|
||||||
|
|
||||||
def run(["home_timeline", nickname]) do
|
def run(["home_timeline", nickname]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
user = Repo.get_by!(User, nickname: nickname)
|
user = Repo.get_by!(User, nickname: nickname)
|
||||||
|
|
|
@ -31,8 +31,6 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
|
||||||
if is_map(response.body) and method != :head do
|
if is_map(response.body) and method != :head do
|
||||||
{:ok, response.status, response.headers, response.body}
|
{:ok, response.status, response.headers, response.body}
|
||||||
else
|
else
|
||||||
conn_pid = response.opts[:adapter][:conn]
|
|
||||||
ConnectionPool.release_conn(conn_pid)
|
|
||||||
{:ok, response.status, response.headers}
|
{:ok, response.status, response.headers}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -43,8 +41,7 @@ defmodule Pleroma.ReverseProxy.Client.Tesla 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, fin: true}) do
|
def stream_body(%{pid: _pid, fin: true}) do
|
||||||
ConnectionPool.release_conn(pid)
|
|
||||||
:done
|
:done
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -68,8 +65,7 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
@spec close(map) :: :ok | no_return()
|
@spec close(map) :: :ok | no_return()
|
||||||
def close(%{pid: pid}) do
|
def close(%{pid: _pid}) do
|
||||||
ConnectionPool.release_conn(pid)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp check_adapter do
|
defp check_adapter do
|
||||||
|
|
Loading…
Reference in a new issue