refactor: demote hidden config to hardcoded value
This commit is contained in:
parent
30259284d1
commit
6dbf015c93
|
@ -21,6 +21,14 @@
|
|||
%% Type declarations
|
||||
%%------------------------------------------------------------------------------
|
||||
|
||||
-ifdef(TEST).
|
||||
%% ms
|
||||
-define(TALLY_ROUTES_INTERVAL, 300).
|
||||
-else.
|
||||
%% ms
|
||||
-define(TALLY_ROUTES_INTERVAL, 15_000).
|
||||
-endif.
|
||||
|
||||
%% call/cast/info events
|
||||
-record(tally_routes, {}).
|
||||
|
||||
|
@ -71,7 +79,7 @@ ensure_timer(Event, Timeout) ->
|
|||
handle_tally_routes() ->
|
||||
ClusterNames = cluster_names(),
|
||||
tally_routes(ClusterNames),
|
||||
ensure_timer(#tally_routes{}, emqx_cluster_link_config:tally_routes_interval()),
|
||||
ensure_timer(#tally_routes{}, ?TALLY_ROUTES_INTERVAL),
|
||||
ok.
|
||||
|
||||
tally_routes([ClusterName | ClusterNames]) ->
|
||||
|
|
|
@ -46,9 +46,7 @@
|
|||
%% Actor Lifecycle
|
||||
actor_ttl/0,
|
||||
actor_gc_interval/0,
|
||||
actor_heartbeat_interval/0,
|
||||
%% Metrics
|
||||
tally_routes_interval/0
|
||||
actor_heartbeat_interval/0
|
||||
]).
|
||||
|
||||
-export([
|
||||
|
@ -165,10 +163,6 @@ actor_gc_interval() ->
|
|||
actor_heartbeat_interval() ->
|
||||
actor_ttl() div 3.
|
||||
|
||||
-spec tally_routes_interval() -> _Milliseconds :: timeout().
|
||||
tally_routes_interval() ->
|
||||
emqx_config:get([cluster, tally_routes_interval]).
|
||||
|
||||
%%
|
||||
|
||||
mk_emqtt_options(#{server := Server, ssl := #{enable := EnableSsl} = Ssl} = LinkConf) ->
|
||||
|
|
|
@ -32,14 +32,7 @@ roots() -> [].
|
|||
injected_fields() ->
|
||||
#{
|
||||
cluster => [
|
||||
{links, links_schema(#{})},
|
||||
{tally_routes_interval,
|
||||
hoconsc:mk(
|
||||
emqx_schema:timeout_duration(), #{
|
||||
default => <<"15s">>,
|
||||
importance => ?IMPORTANCE_HIDDEN
|
||||
}
|
||||
)}
|
||||
{links, links_schema(#{})}
|
||||
]
|
||||
}.
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ mk_source_cluster(BaseName, Config) ->
|
|||
SourceConf =
|
||||
"cluster {"
|
||||
"\n name = cl.source"
|
||||
"\n tally_routes_interval = 300ms"
|
||||
"\n links = ["
|
||||
"\n { enable = true"
|
||||
"\n name = cl.target"
|
||||
|
@ -76,7 +75,6 @@ mk_target_cluster(BaseName, Config) ->
|
|||
TargetConf =
|
||||
"cluster {"
|
||||
"\n name = cl.target"
|
||||
"\n tally_routes_interval = 300ms"
|
||||
"\n links = ["
|
||||
"\n { enable = true"
|
||||
"\n name = cl.source"
|
||||
|
|
Loading…
Reference in New Issue