From 36720bc6e2b880568085e9d981a8ca59fd48b9a2 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Wed, 1 May 2024 01:42:34 +0300 Subject: [PATCH] node: fix stats getting to avoid deadlock --- src/node/node.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node/node.rs b/src/node/node.rs index 98453d7..568b83d 100644 --- a/src/node/node.rs +++ b/src/node/node.rs @@ -134,8 +134,8 @@ impl Node { } /// Get [`StratumServer`] statistics. - pub fn get_stratum_stats() -> grin_util::RwLockReadGuard<'static, StratumStats> { - NODE_STATE.stratum_stats.read() + pub fn get_stratum_stats() -> StratumStats { + NODE_STATE.stratum_stats.read().clone() } /// Stop [`StratumServer`]. @@ -169,8 +169,8 @@ impl Node { } /// Get node [`Server`] statistics. - pub fn get_stats() -> RwLockReadGuard<'static, Option> { - NODE_STATE.stats.read().unwrap() + pub fn get_stats() -> Option { + NODE_STATE.stats.read().unwrap().clone() } /// Check if [`Server`] is not syncing (disabled or just running after synchronization).