From 7fb95ddb314e0a0490b615b6845b72be9efd78dd Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 21 Apr 2020 16:00:06 +0300 Subject: [PATCH] fix for conn_state --- lib/pleroma/pool/connections.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/pool/connections.ex b/lib/pleroma/pool/connections.ex index b4699edf7..b9618d3c7 100644 --- a/lib/pleroma/pool/connections.ex +++ b/lib/pleroma/pool/connections.ex @@ -95,7 +95,7 @@ defmodule Pleroma.Pool.Connections do with true <- Process.alive?(conn_pid), {key, conn} <- find_conn(state.conns, conn_pid), 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}) else @@ -186,10 +186,12 @@ defmodule Pleroma.Pool.Connections do state = with {key, conn} <- find_conn(state.conns, conn_pid, key), {true, key} <- {Process.alive?(conn_pid), key} do + conn_state = if conn.used_by == [], do: :idle, else: :active + put_in(state.conns[key], %{ conn | gun_state: :up, - conn_state: :active, + conn_state: conn_state, retries: 0 }) else