Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro M. Ramallo <alejandro.ramallo@leapsight.com>
  • Loading branch information
aramallo committed Sep 28, 2023
1 parent 67fdcaf commit c8f37d0
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/partisan_pluggable_peer_service_manager.erl
Original file line number Diff line number Diff line change
Expand Up @@ -553,19 +553,15 @@ forward_message(Node, ServerRef, Message, Opts) when is_map(Opts) ->
andalso not NeedsAck
andalso not CausalDelivery,

case FastForward of
true ->
%% Concurrent execution
%% Attempt to fast-path by accessing the connection
%% directly
case partisan_peer_connections:dispatch(Cmd) of
ok ->
ok;
{error, _} ->
gen_server:call(?MODULE, Cmd, infinity)
end;
false ->
%% Serialized execution
%% Attempt to fast-forward sending to the connection directly
case FastForward andalso partisan_peer_connections:dispatch(Cmd) of
ok ->
ok;

_ ->
%% FastForward == false or {error, _} from dispatch
%% We do a serialized execution as Opts might require
%% retransmission
gen_server:call(?MODULE, Cmd, infinity)
end
end.
Expand Down

0 comments on commit c8f37d0

Please sign in to comment.