25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Get nodes from ejabberd_cluster instead of mnesia

This commit is contained in:
Christophe Romain 2017-01-03 17:21:02 +01:00
parent 32e5781a6a
commit a910ab8171
2 changed files with 11 additions and 6 deletions

View File

@ -27,7 +27,7 @@
%% API
-export([get_nodes/0, call/4, multicall/3, multicall/4]).
-export([join/1, leave/1]).
-export([join/1, leave/1, get_known_nodes/0]).
-include("ejabberd.hrl").
-include("logger.hrl").
@ -37,6 +37,12 @@
get_nodes() ->
mnesia:system_info(running_db_nodes).
-spec get_known_nodes() -> [node()].
get_known_nodes() ->
lists:usort(mnesia:system_info(db_nodes)
++ mnesia:system_info(extra_db_nodes)).
-spec call(node(), module(), atom(), [any()]) -> any().
call(Node, Module, Function, Args) ->

View File

@ -1805,9 +1805,8 @@ histogram([], _Integral, _Current, Count, Hist) ->
%%%% get_nodes
get_nodes(Lang) ->
RunningNodes = mnesia:system_info(running_db_nodes),
StoppedNodes = lists:usort(mnesia:system_info(db_nodes)
++ mnesia:system_info(extra_db_nodes))
RunningNodes = ejabberd_cluster:get_nodes(),
StoppedNodes = ejabberd_clustet:get_known_nodes()
-- RunningNodes,
FRN = if RunningNodes == [] -> ?CT(<<"None">>);
true ->
@ -1833,8 +1832,8 @@ get_nodes(Lang) ->
?XCT(<<"h3">>, <<"Stopped Nodes">>), FSN].
search_running_node(SNode) ->
search_running_node(SNode,
mnesia:system_info(running_db_nodes)).
RunningNodes = ejabberd_cluster:get_nodes(),
search_running_node(SNode, RunningNodes).
search_running_node(_, []) -> false;
search_running_node(SNode, [Node | Nodes]) ->