Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions deps/rabbit_common/src/rabbit_data_coercion.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
-export([to_binary/1, to_list/1, to_atom/1, to_integer/1, to_proplist/1, to_map/1]).
-export([to_atom/2, atomize_keys/1, to_list_of_binaries/1]).
-export([to_utf8_binary/1, to_unicode_charlist/1]).
-export([as_list/1]).

-spec to_binary(Val :: binary() | list() | atom() | integer() | function()) -> binary().
to_binary(Val) when is_list(Val) -> list_to_binary(Val);
Expand Down Expand Up @@ -109,3 +110,9 @@ to_unicode_charlist(Val) ->
UnicodeValue ->
UnicodeValue
end.

-spec as_list(list() | any()) -> [any()].
as_list(Nodes) when is_list(Nodes) ->
Nodes;
as_list(Other) ->
[Other].
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
-compile(export_all).
-endif.

-import(rabbit_data_coercion, [as_list/1]).

-define(CONFIG_MODULE, rabbit_peer_discovery_config).
-define(CONFIG_KEY, node_cleanup).

Expand Down Expand Up @@ -241,7 +243,7 @@ maybe_cleanup(State, UnreachableNodes) ->
"Peer discovery: cleanup discovered unreachable nodes: ~tp",
[UnreachableNodes],
#{domain => ?RMQLOG_DOMAIN_PEER_DIS}),
case lists:subtract(UnreachableNodes, service_discovery_nodes()) of
case lists:subtract(as_list(UnreachableNodes), as_list(service_discovery_nodes())) of
[] ->
?LOG_DEBUG(
"Peer discovery: all unreachable nodes are still "
Expand Down Expand Up @@ -304,7 +306,8 @@ unreachable_nodes() ->
service_discovery_nodes() ->
Module = rabbit_peer_discovery:backend(),
case rabbit_peer_discovery:normalize(Module:list_nodes()) of
{ok, {Nodes, _Type}} ->
{ok, {OneOrMultipleNodes, _Type}} ->
Nodes = as_list(OneOrMultipleNodes),
?LOG_DEBUG(
"Peer discovery cleanup: ~tp returned ~tp",
[Module, Nodes],
Expand Down
Loading