forked from AkkomaGang/akkoma
Connection pool: check that there actually is a result
Sometimes connections died before being released to the pool, resulting in MatchErrors
This commit is contained in:
parent
fffbcffb8c
commit
d08b157699
1 changed files with 8 additions and 2 deletions
|
@ -119,11 +119,17 @@ defp get_gun_pid_from_worker(worker_pid) 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
|
||||
|
|
Loading…
Reference in a new issue