From 18c9f796a715706017a0e0d3fa088f26be92b325 Mon Sep 17 00:00:00 2001 From: Eric Semeniuc <3838856+esemeniuc@users.noreply.github.com> Date: Thu, 7 Dec 2023 18:50:08 -0800 Subject: [PATCH] pr feedback --- core/src/proxy/block_engine_stage.rs | 10 +++++----- core/src/proxy/mod.rs | 4 ---- core/src/proxy/relayer_stage.rs | 4 ++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/core/src/proxy/block_engine_stage.rs b/core/src/proxy/block_engine_stage.rs index 9e65073e9d..caf45ac0d9 100644 --- a/core/src/proxy/block_engine_stage.rs +++ b/core/src/proxy/block_engine_stage.rs @@ -155,7 +155,7 @@ impl BlockEngineStage { let block_engine_config = block_engine_config.clone(); task::spawn_blocking(move || block_engine_config.lock().unwrap().clone()) .await - .expect("Failed to get execute tokio task.") + .unwrap() }; if !Self::is_valid_block_engine_config(&local_block_engine_config) { sleep(CONNECTION_BACKOFF).await; @@ -341,7 +341,7 @@ impl BlockEngineStage { } }) .await - .map_err(ProxyError::TokioJoinError)?; + .unwrap(); } Self::consume_bundle_and_packet_stream( @@ -417,7 +417,7 @@ impl BlockEngineStage { let global_config = global_config.clone(); if *local_config != task::spawn_blocking(move || global_config.lock().unwrap().clone()) .await - .map_err(ProxyError::TokioJoinError)? { + .unwrap() { return Err(ProxyError::AuthenticationConnectionError("block engine config changed".to_string())); } @@ -440,7 +440,7 @@ impl BlockEngineStage { let access_token = access_token.clone(); task::spawn_blocking(move || *access_token.lock().unwrap() = new_token) .await - .map_err(ProxyError::TokioJoinError)?; + .unwrap(); } if let Some(new_token) = maybe_new_refresh { num_full_refreshes += 1; @@ -471,7 +471,7 @@ impl BlockEngineStage { } }) .await - .map_err(ProxyError::TokioJoinError)?; + .unwrap(); } } } diff --git a/core/src/proxy/mod.rs b/core/src/proxy/mod.rs index 9e6a298d4b..86d48482aa 100644 --- a/core/src/proxy/mod.rs +++ b/core/src/proxy/mod.rs @@ -21,7 +21,6 @@ use { result, }, thiserror::Error, - tokio::task::JoinError, tonic::Status, }; @@ -98,7 +97,4 @@ pub enum ProxyError { #[error("MethodError: {0:?}")] MethodError(String), - - #[error("TokioJoinError: {0:?}")] - TokioJoinError(JoinError), } diff --git a/core/src/proxy/relayer_stage.rs b/core/src/proxy/relayer_stage.rs index 3a43a7d502..0c8ce22877 100644 --- a/core/src/proxy/relayer_stage.rs +++ b/core/src/proxy/relayer_stage.rs @@ -398,7 +398,7 @@ impl RelayerStage { let global_config = global_config.clone(); if *local_config != task::spawn_blocking(move || global_config.lock().unwrap().clone()) .await - .map_err(ProxyError::TokioJoinError)? { + .unwrap() { return Err(ProxyError::AuthenticationConnectionError("relayer config changed".to_string())); } @@ -421,7 +421,7 @@ impl RelayerStage { let access_token = access_token.clone(); task::spawn_blocking(move || *access_token.lock().unwrap() = new_token) .await - .map_err(ProxyError::TokioJoinError)?; + .unwrap(); } if let Some(new_token) = maybe_new_refresh { num_full_refreshes += 1;