Merge branch 'feat/connection-worker-monitor-flush' into 'develop'
ConnectionPool Worker: use monitor flush instead of checking ref See merge request pleroma/pleroma!3002
This commit is contained in:
commit
a4f80e1e74
@ -93,12 +93,8 @@ def handle_call(:remove_client, {client_pid, _}, %{key: key} = state) 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 @@ def handle_call(:remove_client, {client_pid, _}, %{key: key} = state) 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 New Issue
Block a user