forked from mirrors/akkoma
temp fix for :gun.info
MatchError
This commit is contained in:
parent
3805e09b9c
commit
35471205f8
1 changed files with 16 additions and 9 deletions
|
@ -169,6 +169,10 @@ defmodule Pleroma.Pool.Connections do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_info({:gun_up, conn_pid, _protocol}, state) do
|
def handle_info({:gun_up, conn_pid, _protocol}, state) do
|
||||||
|
# TODO: temp fix for gun MatchError https://github.com/ninenines/gun/issues/222
|
||||||
|
# TODO: REMOVE LATER
|
||||||
|
{key, conn} =
|
||||||
|
try do
|
||||||
%{origin_host: host, origin_scheme: scheme, origin_port: port} = Gun.info(conn_pid)
|
%{origin_host: host, origin_scheme: scheme, origin_port: port} = Gun.info(conn_pid)
|
||||||
|
|
||||||
host =
|
host =
|
||||||
|
@ -178,10 +182,13 @@ defmodule Pleroma.Pool.Connections do
|
||||||
end
|
end
|
||||||
|
|
||||||
key = "#{scheme}:#{host}:#{port}"
|
key = "#{scheme}:#{host}:#{port}"
|
||||||
|
find_conn(state.conns, conn_pid, key)
|
||||||
|
rescue
|
||||||
|
MatcheError -> find_conn(state.conns, conn_pid)
|
||||||
|
end
|
||||||
|
|
||||||
state =
|
state =
|
||||||
with {_key, conn} <- find_conn(state.conns, conn_pid, key),
|
with {true, key} <- {Process.alive?(conn_pid), key} do
|
||||||
{true, key} <- {Process.alive?(conn_pid), key} do
|
|
||||||
put_in(state.conns[key], %{
|
put_in(state.conns[key], %{
|
||||||
conn
|
conn
|
||||||
| gun_state: :up,
|
| gun_state: :up,
|
||||||
|
|
Loading…
Reference in a new issue