fix(gun): tolerate a missing client monitor on release

A client that is already gone leaves no monitor to demonitor. Crashing
the worker takes the shared connection down with it and fails every
other client using it.
This commit is contained in:
Lain Soykaf 2026-07-25 18:46:44 +04:00
commit f985346fe8
No known key found for this signature in database

View file

@ -98,7 +98,9 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do
{ref, state} = pop_in(state.client_monitors[client_pid]) {ref, state} = pop_in(state.client_monitors[client_pid])
Process.demonitor(ref, [:flush]) # A client that is already gone has no monitor left. Tolerate it rather than
# crashing the worker, which would take the shared connection down with it.
if ref, do: Process.demonitor(ref, [:flush])
timer = timer =
if used_by == [] do if used_by == [] do