diff --git a/lib/pleroma/gun/conn.ex b/lib/pleroma/gun/conn.ex index cd25a2e74..a0f110b42 100644 --- a/lib/pleroma/gun/conn.ex +++ b/lib/pleroma/gun/conn.ex @@ -26,7 +26,7 @@ defmodule Pleroma.Gun.Conn do defstruct conn: nil, gun_state: :open, - conn_state: :init, + conn_state: :idle, used_by: [], last_reference: 0, crf: 1, @@ -62,7 +62,6 @@ defmodule Pleroma.Gun.Conn do conn = %Pleroma.Gun.Conn{ conn: conn_pid, gun_state: :up, - conn_state: :active, last_reference: :os.system_time(:second) } diff --git a/lib/pleroma/pool/connections.ex b/lib/pleroma/pool/connections.ex index 984057ab9..b4699edf7 100644 --- a/lib/pleroma/pool/connections.ex +++ b/lib/pleroma/pool/connections.ex @@ -226,6 +226,7 @@ defmodule Pleroma.Pool.Connections do put_in(state.conns[key], %{ conn | gun_state: :down, + conn_state: :idle, retries: conn.retries + 1 }) end diff --git a/test/pool/connections_test.exs b/test/pool/connections_test.exs index ad56e582f..a7afb2190 100644 --- a/test/pool/connections_test.exs +++ b/test/pool/connections_test.exs @@ -97,6 +97,16 @@ defmodule Pleroma.Pool.ConnectionsTest do refute Connections.checkin(url, name) :ok = Conn.open(url, name) + %Connections{ + conns: %{ + ^key => %Conn{ + gun_state: :up, + used_by: [], + conn_state: :idle + } + } + } = Connections.get_state(name) + conn = Connections.checkin(url, name) assert is_pid(conn) assert Process.alive?(conn)