mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
fix(cache): drain pending removals during clear (#4759)
This commit is contained in:
@@ -330,8 +330,15 @@ impl MokaBackend {
|
||||
/// index). Rare admin `clear()` path only.
|
||||
pub async fn clear(&self) -> ObjectDataCacheInvalidationResult {
|
||||
let removed = self.index.remove_matching(|_| true).await.len();
|
||||
self.cache.invalidate_all();
|
||||
self.cache.run_pending_tasks().await;
|
||||
self.cache.invalidate_all();
|
||||
for _ in 0..8 {
|
||||
self.cache.run_pending_tasks().await;
|
||||
if self.cache.entry_count() == 0 {
|
||||
break;
|
||||
}
|
||||
tokio::task::yield_now().await;
|
||||
}
|
||||
Self::invalidation_result(removed)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user