From: rinpatch Date: Wed, 6 May 2020 18:51:10 +0000 (+0300) Subject: Connection pool: check that there actually is a result X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=d08b1576990ca33ac4178fb757ec03a777c55b5b;p=akkoma Connection pool: check that there actually is a result Sometimes connections died before being released to the pool, resulting in MatchErrors --- diff --git a/lib/pleroma/gun/connection_pool.ex b/lib/pleroma/gun/connection_pool.ex index ed7ddff81..0daf1da44 100644 --- a/lib/pleroma/gun/connection_pool.ex +++ b/lib/pleroma/gun/connection_pool.ex @@ -119,11 +119,17 @@ defmodule Pleroma.Gun.ConnectionPool do end def release_conn(conn_pid) do - [worker_pid] = + query_result = Registry.select(@registry, [ {{:_, :"$1", {:"$2", :_, :_, :_}}, [{:==, :"$2", conn_pid}], [:"$1"]} ]) - GenServer.cast(worker_pid, {:remove_client, self()}) + case query_result do + [worker_pid] -> + GenServer.cast(worker_pid, {:remove_client, self()}) + + [] -> + :ok + end end end