diff options
| author | rinpatch <rinpatch@sdf.org> | 2020-07-28 21:16:45 +0000 | 
|---|---|---|
| committer | rinpatch <rinpatch@sdf.org> | 2020-07-28 21:16:45 +0000 | 
| commit | 93dbba9b8a5aacbbf43a45a07e27b328579eabf8 (patch) | |
| tree | ca92b20e748d4684e857cdfeae9e177b9018f87f /lib | |
| parent | f462f1c101b1a82cbe633a55368b04582e4fcbd4 (diff) | |
| parent | dab1d8c98efd462ecb9aac47f7c54a5e3e015e27 (diff) | |
| download | pleroma-93dbba9b8a5aacbbf43a45a07e27b328579eabf8.tar.gz pleroma-93dbba9b8a5aacbbf43a45a07e27b328579eabf8.zip | |
Merge branch 'fix/gun-pool-missing-cast' into 'develop'
gun ConnectionPool: Re-add a missing cast for remove_client
See merge request pleroma/pleroma!2805
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pleroma/gun/connection_pool.ex | 2 | ||||
| -rw-r--r-- | lib/pleroma/gun/connection_pool/worker.ex | 14 | 
2 files changed, 12 insertions, 4 deletions
| diff --git a/lib/pleroma/gun/connection_pool.ex b/lib/pleroma/gun/connection_pool.ex index c6894be53..49e9885bb 100644 --- a/lib/pleroma/gun/connection_pool.ex +++ b/lib/pleroma/gun/connection_pool.ex @@ -45,7 +45,7 @@ defmodule Pleroma.Gun.ConnectionPool do      # so instead we use cast + monitor      ref = Process.monitor(worker_pid) -    if register, do: GenServer.cast(worker_pid, {:add_client, self(), true}) +    if register, do: GenServer.cast(worker_pid, {:add_client, self()})      receive do        {:conn_pid, pid} -> diff --git a/lib/pleroma/gun/connection_pool/worker.ex b/lib/pleroma/gun/connection_pool/worker.ex index a61892c60..fec9d0efa 100644 --- a/lib/pleroma/gun/connection_pool/worker.ex +++ b/lib/pleroma/gun/connection_pool/worker.ex @@ -36,10 +36,18 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do    end    @impl true -  def handle_cast({:add_client, client_pid, send}, state) do +  def handle_cast({:add_client, client_pid}, state) do      case handle_call(:add_client, {client_pid, nil}, state) do        {:reply, conn_pid, state, :hibernate} -> -        if send, do: send(client_pid, {:conn_pid, conn_pid}) +        send(client_pid, {:conn_pid, conn_pid}) +        {:noreply, state, :hibernate} +    end +  end + +  @impl true +  def handle_cast({:remove_client, client_pid}, state) do +    case handle_call(:remove_client, {client_pid, nil}, state) do +      {:reply, _, state, :hibernate} ->          {:noreply, state, :hibernate}      end    end @@ -115,7 +123,7 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do        %{key: state.key}      ) -    handle_cast({:remove_client, pid, false}, state) +    handle_cast({:remove_client, pid}, state)    end    # LRFU policy: https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.55.1478 | 
