summaryrefslogtreecommitdiffstats
path: root/src/api/stats/prometheus.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
commit7b7dcb5a77061cb69d368de263a02b5ad26fbf51 (patch)
treed3255ce629cb60059cb55191dc206d0f64ca645e /src/api/stats/prometheus.rs
parentd668ce2ff8f308e54c1c7a2c145cb3479cab899d (diff)
unify lock logic
Diffstat (limited to 'src/api/stats/prometheus.rs')
-rw-r--r--src/api/stats/prometheus.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/api/stats/prometheus.rs b/src/api/stats/prometheus.rs
index 74c18e9..07a6cc8 100644
--- a/src/api/stats/prometheus.rs
+++ b/src/api/stats/prometheus.rs
@@ -7,6 +7,7 @@ use std::fmt::Write;
use tokio::time::Instant;
use super::StatsResponse;
+use crate::locks::MutexExt;
use crate::state::{AppState, Incidents, Liveness};
use crate::transport::traffic::{ByKind, Counter, PeerTraffic};
@@ -136,8 +137,7 @@ async fn peers(state: &AppState) -> Vec<Peer> {
.map(|rtt| rtt.as_secs_f64());
let throughput = state
.throughput
- .lock()
- .unwrap_or_else(|poisoned| poisoned.into_inner())
+ .lock_or_recover()
.get(&key)
.map(|estimate| estimate.bytes_per_sec);
let traffic = state.traffic.peer(&key).unwrap_or_default();