mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-18 10:43:15 +00:00
@@ -106,16 +106,15 @@ impl Drop for LockGuard {
|
|||||||
tracing::warn!("LockGuard channel send failed ({}), spawning fallback unlock task for {}", err, lock_id);
|
tracing::warn!("LockGuard channel send failed ({}), spawning fallback unlock task for {}", err, lock_id);
|
||||||
|
|
||||||
// If runtime is not available, this will panic; but in RustFS we are inside Tokio contexts.
|
// If runtime is not available, this will panic; but in RustFS we are inside Tokio contexts.
|
||||||
let _ = tokio::spawn(async move {
|
let handle = tokio::spawn(async move {
|
||||||
let futures = clients
|
let futures_iter = clients.into_iter().map(|client| {
|
||||||
.into_iter()
|
let id = lock_id.clone();
|
||||||
.map(|client| {
|
async move { client.release(&id).await.unwrap_or(false) }
|
||||||
let id = lock_id.clone();
|
});
|
||||||
async move { client.release(&id).await.unwrap_or(false) }
|
let _ = futures::future::join_all(futures_iter).await;
|
||||||
})
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
let _ = futures::future::join_all(futures).await;
|
|
||||||
});
|
});
|
||||||
|
// Explicitly drop the JoinHandle to acknowledge detaching the task.
|
||||||
|
std::mem::drop(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,13 +97,7 @@ impl LocalLockMap {
|
|||||||
guard.remove(&k);
|
guard.remove(&k);
|
||||||
}
|
}
|
||||||
let wait = if due.is_empty() {
|
let wait = if due.is_empty() {
|
||||||
next_deadline.and_then(|dl| {
|
next_deadline.map(|dl| if dl > now { dl - now } else { Duration::from_millis(0) })
|
||||||
if dl > now {
|
|
||||||
Some(dl - now)
|
|
||||||
} else {
|
|
||||||
Some(Duration::from_millis(0))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
Some(Duration::from_millis(0))
|
Some(Duration::from_millis(0))
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user