mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
ConnectionPool Worker: use monitor flush instead of checking ref
`:flush` removes the DOWN message if one had arrived, so this check should no longer be necessary.
This commit is contained in:
parent
5c4ff5c73c
commit
adb1b0282d
1 changed files with 9 additions and 16 deletions
|
@ -93,12 +93,8 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do
|
||||||
end)
|
end)
|
||||||
|
|
||||||
{ref, state} = pop_in(state.client_monitors[client_pid])
|
{ref, state} = pop_in(state.client_monitors[client_pid])
|
||||||
# DOWN message can receive right after `remove_client` call and cause worker to terminate
|
|
||||||
state =
|
Process.demonitor(ref, [:flush])
|
||||||
if is_nil(ref) do
|
|
||||||
state
|
|
||||||
else
|
|
||||||
Process.demonitor(ref)
|
|
||||||
|
|
||||||
timer =
|
timer =
|
||||||
if used_by == [] do
|
if used_by == [] do
|
||||||
|
@ -108,10 +104,7 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
%{state | timer: timer}
|
{:reply, :ok, %{state | timer: timer}, :hibernate}
|
||||||
end
|
|
||||||
|
|
||||||
{:reply, :ok, state, :hibernate}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
|
Loading…
Reference in a new issue