fix for conn_state

This commit is contained in:
Alexander Strizhakov 2020-04-21 16:00:06 +03:00
parent ec282d1d62
commit 7fb95ddb31
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381

View File

@ -95,7 +95,7 @@ defmodule Pleroma.Pool.Connections do
with true <- Process.alive?(conn_pid), with true <- Process.alive?(conn_pid),
{key, conn} <- find_conn(state.conns, conn_pid), {key, conn} <- find_conn(state.conns, conn_pid),
used_by <- List.keydelete(conn.used_by, pid, 0) do used_by <- List.keydelete(conn.used_by, pid, 0) do
conn_state = if used_by == [], do: :idle, else: conn.conn_state conn_state = if used_by == [], do: :idle, else: :active
put_in(state.conns[key], %{conn | conn_state: conn_state, used_by: used_by}) put_in(state.conns[key], %{conn | conn_state: conn_state, used_by: used_by})
else else
@ -186,10 +186,12 @@ defmodule Pleroma.Pool.Connections do
state = state =
with {key, conn} <- find_conn(state.conns, conn_pid, key), with {key, conn} <- find_conn(state.conns, conn_pid, key),
{true, key} <- {Process.alive?(conn_pid), key} do {true, key} <- {Process.alive?(conn_pid), key} do
conn_state = if conn.used_by == [], do: :idle, else: :active
put_in(state.conns[key], %{ put_in(state.conns[key], %{
conn conn
| gun_state: :up, | gun_state: :up,
conn_state: :active, conn_state: conn_state,
retries: 0 retries: 0
}) })
else else