aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/peers.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-26 04:20:52 +0100
committertv <tv@krebsco.de>2026-10-26 04:20:52 +0100
commit2ff446bdb5c5b82b653eac822061aaeb686c3ccc (patch)
tree24b34021a6f4f2029c59c7909c5174ad29136a69 /src/api/peers.rs
parent735b27ad691f768027d6034a3f50efbd68feda89 (diff)
unify lock logic
Diffstat (limited to 'src/api/peers.rs')
-rw-r--r--src/api/peers.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/api/peers.rs b/src/api/peers.rs
index a9694f7..fac3440 100644
--- a/src/api/peers.rs
+++ b/src/api/peers.rs
@@ -16,6 +16,7 @@ use utoipa::ToSchema;
use super::store_status;
use crate::document::replica::Epoch;
use crate::document::store;
+use crate::locks::MutexExt;
use crate::state::{AppState, HelloState, Incidents, Liveness, PeerState};
use crate::swarm::peer::forgotten_path;
use crate::transport::traffic::PeerTraffic;
@@ -141,8 +142,7 @@ pub(crate) async fn list_peers(
let traffic = state.traffic.peer(&public_key).unwrap_or_default();
let sync_throughput = state
.throughput
- .lock()
- .unwrap_or_else(|poisoned| poisoned.into_inner())
+ .lock_or_recover()
.get(&public_key)
.map(|estimate| ThroughputInfo {
bytes_per_sec: estimate.bytes_per_sec.round(),