Distributor should excert backpressure due to filtering overhead

This commit is contained in:
Alain Zscheile 2022-11-27 21:46:15 +01:00
parent c74d1b061c
commit 30daf44281
2 changed files with 3 additions and 3 deletions

View file

@ -58,7 +58,7 @@ defmodule Floof.Distributor do
end
@impl true
def handle_cast({:xfer, {origin, dcdhash, dcd}}, state) do
def handle_call({:xfer, {origin, dcdhash, dcd}}, _, state) do
# we split the state such that only the parts necessary get
# copied into the spawned-off process
fconf = dstate(state, :fconf)
@ -99,7 +99,7 @@ defmodule Floof.Distributor do
end)
end
{:noreply, state}
{:reply, :ok, state}
end
@impl true

View file

@ -6,7 +6,7 @@ defmodule Floof.Message do
def emit(xf) do
{:XferBlob, _, _, _, xfinner} = xf
mhash = :crypto.hash(:blake2b, xfinner)
GenServer.cast(Floof.Distributor, {:xfer, {self(), mhash, xf}})
GenServer.call(Floof.Distributor, {:xfer, {self(), mhash, xf}})
mhash
end