refactor(emqx_conf): Decorate get_override_config_file

This commit is contained in:
k32 2022-01-13 00:58:31 +01:00
parent 727dec14c7
commit d84a3fe291
2 changed files with 7 additions and 1 deletions

View File

@ -44,7 +44,7 @@ copy_override_conf_from_core_node() ->
?SLOG(debug, #{msg => "skip_copy_overide_conf_from_core_node"}), ?SLOG(debug, #{msg => "skip_copy_overide_conf_from_core_node"}),
{ok, -1}; {ok, -1};
Nodes -> Nodes ->
{Results, Failed} = rpc:multicall(Nodes, ?MODULE, get_override_config_file, [], 20000), {Results, Failed} = emqx_conf_proto_v1:get_override_config_file(Nodes),
{Ready, NotReady0} = lists:partition(fun(Res) -> element(1, Res) =:= ok end, Results), {Ready, NotReady0} = lists:partition(fun(Res) -> element(1, Res) =:= ok end, Results),
NotReady = lists:filter(fun(Res) -> element(1, Res) =:= error end, NotReady0), NotReady = lists:filter(fun(Res) -> element(1, Res) =:= error end, NotReady0),
case (Failed =/= [] orelse NotReady =/= []) andalso Ready =/= [] of case (Failed =/= [] orelse NotReady =/= []) andalso Ready =/= [] of

View File

@ -31,6 +31,8 @@
, reset/2 , reset/2
, reset/3 , reset/3
, get_override_config_file/1
]). ]).
-include_lib("emqx/include/bpapi.hrl"). -include_lib("emqx/include/bpapi.hrl").
@ -89,3 +91,7 @@ reset(KeyPath, Opts) ->
| emqx_rpc:badrpc(). | emqx_rpc:badrpc().
reset(Node, KeyPath, Opts) -> reset(Node, KeyPath, Opts) ->
rpc:call(Node, emqx, reset_config, [KeyPath, Opts]). rpc:call(Node, emqx, reset_config, [KeyPath, Opts]).
-spec get_override_config_file([node()]) -> emqx_rpc:multicall_result().
get_override_config_file(Nodes) ->
rpc:multicall(Nodes, emqx_conf_app, get_override_config_file, [], 20000).