From 7b7dcb5a77061cb69d368de263a02b5ad26fbf51 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 26 Oct 2026 04:20:52 +0100 Subject: unify lock logic --- src/swarm/stability.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/swarm/stability.rs') 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 -- cgit v1.3.1