summaryrefslogtreecommitdiffstats
path: root/src/swarm/stability.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/swarm/stability.rs
parentd668ce2ff8f308e54c1c7a2c145cb3479cab899d (diff)
unify lock logic
Diffstat (limited to 'src/swarm/stability.rs')
-rw-r--r--src/swarm/stability.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/swarm/stability.rs b/src/swarm/stability.rs
index 9d79b17..1ee308f 100644
--- a/src/swarm/stability.rs
+++ b/src/swarm/stability.rs
@@ -22,6 +22,7 @@ use std::time::Duration;
use tokio::time::Instant;
use tracing::{info, warn};
+use crate::locks::MutexExt;
use crate::state::{AppState, HelloState};
use crate::swarm::members::{self, Tier};
@@ -129,10 +130,7 @@ impl Stability {
}
fn lock(state: &AppState) -> std::sync::MutexGuard<'_, Stability> {
- state
- .stability
- .lock()
- .unwrap_or_else(|poisoned| poisoned.into_inner())
+ state.stability.lock_or_recover()
}
/// The fraction of the observed time (up to a day) we had a live peer, and how much