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/document/file.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/document') diff --git a/src/document/file.rs b/src/document/file.rs index a773502..6e7a4b6 100644 --- a/src/document/file.rs +++ b/src/document/file.rs @@ -28,6 +28,7 @@ use tracing::{debug, error, warn}; use crate::document::replica::Epoch; use crate::files::{FileKind, Files}; +use crate::locks::MutexExt; use crate::state::AppState; const MAGIC: &[u8] = b"continuum-document/1\n"; @@ -175,9 +176,7 @@ impl DocumentFile { } fn lock(&self) -> MutexGuard<'_, Option> { - self.written - .lock() - .unwrap_or_else(|poisoned| poisoned.into_inner()) + self.written.lock_or_recover() } } -- cgit v1.3.1