From 892c7339394e7560c26f8021320ede0dce12bd2f Mon Sep 17 00:00:00 2001 From: Matthias Wright Date: Fri, 10 May 2024 18:40:06 +0800 Subject: [PATCH] chore(consensus): remove unwrap from join handle await --- core/consensus/src/edge_node/consensus.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/consensus/src/edge_node/consensus.rs b/core/consensus/src/edge_node/consensus.rs index ad8aa1120..681dd87f4 100644 --- a/core/consensus/src/edge_node/consensus.rs +++ b/core/consensus/src/edge_node/consensus.rs @@ -11,7 +11,7 @@ use quick_cache::unsync::Cache; use tokio::pin; use tokio::sync::{mpsc, Notify}; use tokio::task::JoinHandle; -use tracing::info; +use tracing::{error, info}; use super::transaction_store::{NotExecuted, TransactionStore}; use crate::consensus::PubSubMsg; @@ -57,7 +57,13 @@ impl EdgeConsensus { self.tx_shutdown.notify_one(); // Gracefully wait for all the subtasks to finish and return. - self.handle.await.unwrap(); + if let Err(e) = self.handle.await { + error!( + "Failed to join handle in file {} at line {}: {e}", + file!(), + line!() + ); + } } }