MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / read_or_recover

Function read_or_recover

nodedb/src/control/lock_utils.rs:23–31  ·  view source on GitHub ↗

Recover a poisoned `RwLock` read guard, logging a warning.

(
    result: Result<RwLockReadGuard<'a, T>, PoisonError<RwLockReadGuard<'a, T>>>,
    lock_name: &str,
)

Source from the content-addressed store, hash-verified

21
22/// Recover a poisoned `RwLock` read guard, logging a warning.
23pub fn read_or_recover<'a, T>(
24 result: Result<RwLockReadGuard<'a, T>, PoisonError<RwLockReadGuard<'a, T>>>,
25 lock_name: &str,
26) -> RwLockReadGuard<'a, T> {
27 result.unwrap_or_else(|p| {
28 tracing::warn!(lock = lock_name, "RwLock poisoned (read), recovering");
29 p.into_inner()
30 })
31}
32
33/// Recover a poisoned `Mutex` guard, logging a warning.
34pub fn lock_or_recover<'a, T>(

Callers 14

list_topicsMethod · 0.85
publishMethod · 0.85
subscribeMethod · 0.85
subscribe_groupMethod · 0.85
unsubscribeMethod · 0.85
topic_statsMethod · 0.85
shapes_for_sessionMethod · 0.85
evaluate_mutationMethod · 0.85
session_infoMethod · 0.85
total_shapesMethod · 0.85
active_sessionsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected