diff --git a/apps/emqx_cluster_link/src/emqx_cluster_link_bookkeeper.erl b/apps/emqx_cluster_link/src/emqx_cluster_link_bookkeeper.erl index 992fc7bf1..da5d7eaae 100644 --- a/apps/emqx_cluster_link/src/emqx_cluster_link_bookkeeper.erl +++ b/apps/emqx_cluster_link/src/emqx_cluster_link_bookkeeper.erl @@ -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]) -> diff --git a/apps/emqx_cluster_link/src/emqx_cluster_link_config.erl b/apps/emqx_cluster_link/src/emqx_cluster_link_config.erl index fd84a5b7f..2a97f2d69 100644 --- a/apps/emqx_cluster_link/src/emqx_cluster_link_config.erl +++ b/apps/emqx_cluster_link/src/emqx_cluster_link_config.erl @@ -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) -> diff --git a/apps/emqx_cluster_link/src/emqx_cluster_link_schema.erl b/apps/emqx_cluster_link/src/emqx_cluster_link_schema.erl index dd5ab66f6..9b08510b9 100644 --- a/apps/emqx_cluster_link/src/emqx_cluster_link_schema.erl +++ b/apps/emqx_cluster_link/src/emqx_cluster_link_schema.erl @@ -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(#{})} ] }. diff --git a/apps/emqx_cluster_link/test/emqx_cluster_link_SUITE.erl b/apps/emqx_cluster_link/test/emqx_cluster_link_SUITE.erl index 21aa1a70e..e023aacab 100644 --- a/apps/emqx_cluster_link/test/emqx_cluster_link_SUITE.erl +++ b/apps/emqx_cluster_link/test/emqx_cluster_link_SUITE.erl @@ -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"