chore: rename sys_topic to sys_topics
This commit is contained in:
parent
ecc8d92e6c
commit
6dac422c93
|
@ -1083,7 +1083,7 @@ broker {
|
|||
## System Topic
|
||||
##==================================================================
|
||||
|
||||
sys_topic {
|
||||
sys_topics {
|
||||
## System interval of publishing $SYS messages.
|
||||
##
|
||||
## @doc broker.sys_msg_interval
|
||||
|
|
|
@ -144,8 +144,8 @@ roots(medium) ->
|
|||
[ {"broker",
|
||||
sc(ref("broker"),
|
||||
#{})}
|
||||
, {"sys_topic",
|
||||
sc(ref("sys_topic"),
|
||||
, {"sys_topics",
|
||||
sc(ref("sys_topics"),
|
||||
#{})}
|
||||
, {"rate_limit",
|
||||
sc(ref("rate_limit"),
|
||||
|
@ -902,7 +902,7 @@ fields("broker_perf") ->
|
|||
})}
|
||||
];
|
||||
|
||||
fields("sys_topic") ->
|
||||
fields("sys_topics") ->
|
||||
[ {"sys_msg_interval",
|
||||
sc(hoconsc:union([disabled, duration()]),
|
||||
#{ default => "1m"
|
||||
|
|
|
@ -107,13 +107,13 @@ datetime() ->
|
|||
"~4..0w-~2..0w-~2..0w ~2..0w:~2..0w:~2..0w", [Y, M, D, H, MM, S])).
|
||||
|
||||
sys_interval() ->
|
||||
emqx:get_config([sys_topic, sys_msg_interval]).
|
||||
emqx:get_config([sys_topics, sys_msg_interval]).
|
||||
|
||||
sys_heatbeat_interval() ->
|
||||
emqx:get_config([sys_topic, sys_heartbeat_interval]).
|
||||
emqx:get_config([sys_topics, sys_heartbeat_interval]).
|
||||
|
||||
sys_event_message() ->
|
||||
emqx:get_config([sys_topic, sys_event_messages]).
|
||||
emqx:get_config([sys_topics, sys_event_messages]).
|
||||
|
||||
%% @doc Get sys info
|
||||
-spec(info() -> list(tuple())).
|
||||
|
@ -138,12 +138,12 @@ tick(State) ->
|
|||
State#state{ticker = start_timer(sys_interval(), tick)}.
|
||||
|
||||
load_event_hooks() ->
|
||||
maps:foreach(
|
||||
fun(_, false) -> ok;
|
||||
(K, true) ->
|
||||
lists:foreach(
|
||||
fun({_, false}) -> ok;
|
||||
({K, true}) ->
|
||||
{HookPoint, Fun} = hook_and_fun(K),
|
||||
emqx_hooks:put(HookPoint, {?MODULE, Fun, []})
|
||||
end, sys_event_message()).
|
||||
end, maps:to_list(sys_event_message())).
|
||||
|
||||
handle_call(Req, _From, State) ->
|
||||
?SLOG(error, #{msg => "unexpected_call", call => Req}),
|
||||
|
@ -175,10 +175,10 @@ terminate(_Reason, #state{heartbeat = TRef1, ticker = TRef2}) ->
|
|||
lists:foreach(fun emqx_misc:cancel_timer/1, [TRef1, TRef2]).
|
||||
|
||||
unload_event_hooks() ->
|
||||
maps:foreach(fun(K, _) ->
|
||||
lists:foreach(fun({K, _}) ->
|
||||
{HookPoint, Fun} = hook_and_fun(K),
|
||||
emqx_hooks:del(HookPoint, {?MODULE, Fun})
|
||||
end, sys_event_message()).
|
||||
end, maps:to_list(sys_event_message())).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% hook callbacks
|
||||
|
|
|
@ -60,9 +60,9 @@ prop_sys() ->
|
|||
|
||||
do_setup() ->
|
||||
ok = emqx_logger:set_log_level(emergency),
|
||||
emqx_config:put([sys_topic, sys_msg_interval], 60000),
|
||||
emqx_config:put([sys_topic, sys_heartbeat_interval], 30000),
|
||||
emqx_config:put([sys_topic, sys_event_messages],
|
||||
emqx_config:put([sys_topics, sys_msg_interval], 60000),
|
||||
emqx_config:put([sys_topics, sys_heartbeat_interval], 30000),
|
||||
emqx_config:put([sys_topics, sys_event_messages],
|
||||
#{client_connected => true, client_disconnected => true,
|
||||
client_subscribed => true, client_unsubscribed => true}),
|
||||
[mock(Mod) || Mod <- ?mock_modules],
|
||||
|
|
Loading…
Reference in New Issue