From 7115c5f82efe1ca1817da3152ba3cbc66e0da1a4 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 15 Jul 2020 15:58:08 +0300 Subject: [PATCH] ConnectionPool.Worker: do not stop with an error when there is a timeout This produced error log messages about GenServer termination every time the connection was not open due to a timeout. Instead we stop with `{:shutdown, }` since shutting down when the connection can't be established is normal behavior. --- lib/pleroma/gun/connection_pool.ex | 5 ++++- lib/pleroma/gun/connection_pool/worker.ex | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/gun/connection_pool.ex b/lib/pleroma/gun/connection_pool.ex index d3eead7d8..8b41a668c 100644 --- a/lib/pleroma/gun/connection_pool.ex +++ b/lib/pleroma/gun/connection_pool.ex @@ -53,7 +53,10 @@ defmodule Pleroma.Gun.ConnectionPool do {:ok, pid} {:DOWN, ^ref, :process, ^worker_pid, reason} -> - {:error, reason} + case reason do + {:shutdown, error} -> error + _ -> {:error, reason} + end end end diff --git a/lib/pleroma/gun/connection_pool/worker.ex b/lib/pleroma/gun/connection_pool/worker.ex index 16a508ad9..f33447cb6 100644 --- a/lib/pleroma/gun/connection_pool/worker.ex +++ b/lib/pleroma/gun/connection_pool/worker.ex @@ -31,7 +31,7 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do :hibernate} else err -> - {:stop, err, nil} + {:stop, {:shutdown, err}, nil} end end -- 2.44.2