diff options
author | rinpatch <rinpatch@sdf.org> | 2020-05-06 21:51:10 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-07-15 15:17:27 +0300 |
commit | d08b1576990ca33ac4178fb757ec03a777c55b5b (patch) | |
tree | b4ae8876439ac06ed216ff51507f55bb7e9c22e1 | |
parent | fffbcffb8c9ce1e96de5d1a5e15005e271deacd4 (diff) | |
download | pleroma-d08b1576990ca33ac4178fb757ec03a777c55b5b.tar.gz |
Connection pool: check that there actually is a result
Sometimes connections died before being released to the pool, resulting
in MatchErrors
-rw-r--r-- | lib/pleroma/gun/connection_pool.ex | 10 |
1 files changed, 8 insertions, 2 deletions
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 |