From ed7109ce3830ec0801114d2dd008bd38c6213832 Mon Sep 17 00:00:00 2001 From: perekopskiy Date: Mon, 20 May 2024 14:16:30 +0300 Subject: [PATCH] en: run `MainNodeFeeParamsFetcher` only in API --- core/bin/external_node/src/main.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/bin/external_node/src/main.rs b/core/bin/external_node/src/main.rs index dbd6203590f..cdf550e2947 100644 --- a/core/bin/external_node/src/main.rs +++ b/core/bin/external_node/src/main.rs @@ -207,7 +207,6 @@ async fn run_core( task_handles: &mut Vec>>, app_health: &AppHealthCheck, stop_receiver: watch::Receiver, - fee_params_fetcher: Arc, singleton_pool_builder: &ConnectionPoolBuilder, ) -> anyhow::Result { // Create components. @@ -312,8 +311,6 @@ async fn run_core( } let sk_handle = task::spawn(state_keeper.run()); - let fee_params_fetcher_handle = - tokio::spawn(fee_params_fetcher.clone().run(stop_receiver.clone())); let remote_diamond_proxy_addr = config.remote.diamond_proxy_addr; let diamond_proxy_addr = if let Some(addr) = config.optional.contracts_diamond_proxy_addr { anyhow::ensure!( @@ -378,7 +375,6 @@ async fn run_core( task_handles.extend([ sk_handle, - fee_params_fetcher_handle, consistency_checker_handle, commitment_generator_handle, updater_handle, @@ -433,6 +429,10 @@ async fn run_api( stop_receiver.clone(), ))); + let fee_params_fetcher_handle = + tokio::spawn(fee_params_fetcher.clone().run(stop_receiver.clone())); + task_handles.push(fee_params_fetcher_handle); + let tx_sender_builder = TxSenderBuilder::new(config.into(), connection_pool.clone(), Arc::new(tx_proxy)); @@ -633,8 +633,6 @@ async fn init_tasks( task_handles.push(tokio::spawn(fetcher.run(stop_receiver.clone()))); } - let fee_params_fetcher = Arc::new(MainNodeFeeParamsFetcher::new(main_node_client.clone())); - let sync_state = if components.contains(&Component::Core) { run_core( config, @@ -644,7 +642,6 @@ async fn init_tasks( task_handles, app_health, stop_receiver.clone(), - fee_params_fetcher.clone(), &singleton_pool_builder, ) .await? @@ -661,6 +658,7 @@ async fn init_tasks( }; if components.contains(&Component::HttpApi) || components.contains(&Component::WsApi) { + let fee_params_fetcher = Arc::new(MainNodeFeeParamsFetcher::new(main_node_client.clone())); run_api( task_handles, config,