diff --git a/openraft/src/raft/mod.rs b/openraft/src/raft/mod.rs index 3d5aa6acd..dac8d8ab2 100644 --- a/openraft/src/raft/mod.rs +++ b/openraft/src/raft/mod.rs @@ -318,7 +318,7 @@ where C: RaftTypeConfig rx_metrics, rx_data_metrics, rx_server_metrics, - tx_shutdown: Mutex::new(Some(tx_shutdown)), + tx_shutdown: std::sync::Mutex::new(Some(tx_shutdown)), core_state: Mutex::new(CoreState::Running(core_handle)), snapshot: Mutex::new(None), @@ -919,7 +919,7 @@ where C: RaftTypeConfig /// /// It sends a shutdown signal and waits until `RaftCore` returns. pub async fn shutdown(&self) -> Result<(), JoinErrorOf> { - if let Some(tx) = self.inner.tx_shutdown.lock().await.take() { + if let Some(tx) = self.inner.tx_shutdown.lock().unwrap().take() { // A failure to send means the RaftCore is already shutdown. Continue to check the task // return value. let send_res = tx.send(()); diff --git a/openraft/src/raft/raft_inner.rs b/openraft/src/raft/raft_inner.rs index 9fb2caa25..8f26333f4 100644 --- a/openraft/src/raft/raft_inner.rs +++ b/openraft/src/raft/raft_inner.rs @@ -40,9 +40,7 @@ where C: RaftTypeConfig pub(in crate::raft) rx_data_metrics: WatchReceiverOf>, pub(in crate::raft) rx_server_metrics: WatchReceiverOf>, - // TODO(xp): it does not need to be a async mutex. - #[allow(clippy::type_complexity)] - pub(in crate::raft) tx_shutdown: Mutex>>, + pub(in crate::raft) tx_shutdown: std::sync::Mutex>>, pub(in crate::raft) core_state: Mutex>, /// The ongoing snapshot transmission.