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