Skip to content

Commit 990cfc6

Browse files
committed
Merge branch 'release/v5.0.2'
Signed-off-by: Alejandro M. Ramallo <[email protected]>
2 parents 8d4c79e + 3df3d04 commit 990cfc6

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

src/partisan.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{description,
33
"Partisan is a scalable and flexible, TCP-based membership system and distribution layer for the BEAM."
44
},
5-
{vsn, "5.0.1"},
5+
{vsn, "5.0.2"},
66
{registered, []},
77
{applications, [
88
kernel,

src/partisan_plumtree_broadcast.erl

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,20 @@ is_map(Opts) ->
325325
-spec broadcast(any(), module()) -> ok.
326326

327327
broadcast(Broadcast, Mod) ->
328-
{MessageId, Payload} = Mod:broadcast_data(Broadcast),
329-
gen_server:cast(?SERVER, {broadcast, MessageId, Payload, Mod}).
328+
try
329+
{MessageId, Payload} = Mod:broadcast_data(Broadcast),
330+
gen_server:cast(?SERVER, {broadcast, MessageId, Payload, Mod})
331+
332+
catch
333+
Class:Reason:Stacktrace ->
334+
?LOG_NOTICE(#{
335+
description =>
336+
"Exception on callback broadcast_data. Broadcast cancelled.",
337+
class => Class,
338+
reason => Reason,
339+
stacktrace => Stacktrace
340+
})
341+
end.
330342

331343

332344
%% -----------------------------------------------------------------------------
@@ -341,11 +353,24 @@ broadcast(Broadcast, Mod) ->
341353
-spec broadcast_channel(Mod :: module()) -> partisan:channel().
342354

343355
broadcast_channel(Mod) ->
344-
case erlang:function_exported(Mod, broadcast_channel, 0) of
345-
true ->
346-
Mod:broadcast_channel();
347-
false ->
348-
?DEFAULT_CHANNEL
356+
try
357+
case erlang:function_exported(Mod, broadcast_channel, 0) of
358+
true ->
359+
Mod:broadcast_channel();
360+
false ->
361+
?DEFAULT_CHANNEL
362+
end
363+
catch
364+
Class:Reason:Stacktrace ->
365+
?LOG_NOTICE(#{
366+
description =>
367+
"Exception on callback broadcast_channel, "
368+
"returning default channel.",
369+
class => Class,
370+
reason => Reason,
371+
stacktrace => Stacktrace
372+
}),
373+
undefined
349374
end.
350375

351376

@@ -1131,6 +1156,7 @@ exchange(Peer, #state{exchanges = Exchanges} = State, Mod) ->
11311156

11321157
{error, _Reason} ->
11331158
State;
1159+
11341160
_ ->
11351161
State
11361162
end.

0 commit comments

Comments
 (0)