Signed-off-by: junxiang Mu <1948535941@qq.com>
This commit is contained in:
junxiang Mu
2024-12-26 16:25:13 +08:00
parent 83ac391603
commit 57f0370ab8
+4 -1
View File
@@ -1,3 +1,4 @@
use futures::future::join_all;
use madmin::heal_commands::HealResultItem; use madmin::heal_commands::HealResultItem;
use std::{cmp::Ordering, env, path::PathBuf, sync::Arc, time::Duration}; use std::{cmp::Ordering, env, path::PathBuf, sync::Arc, time::Duration};
use tokio::{ use tokio::{
@@ -118,9 +119,10 @@ async fn monitor_local_disks_and_heal() {
} }
} }
let mut futures = Vec::new();
for disk in heal_disks.into_ref().iter() { for disk in heal_disks.into_ref().iter() {
let disk_clone = disk.clone(); let disk_clone = disk.clone();
spawn(async move { futures.push(async move {
GLOBAL_BackgroundHealState GLOBAL_BackgroundHealState
.set_disk_healing_status(disk_clone.clone(), true) .set_disk_healing_status(disk_clone.clone(), true)
.await; .await;
@@ -133,6 +135,7 @@ async fn monitor_local_disks_and_heal() {
GLOBAL_BackgroundHealState.pop_heal_local_disks(&[disk_clone]).await; GLOBAL_BackgroundHealState.pop_heal_local_disks(&[disk_clone]).await;
}); });
} }
let _ = join_all(futures).await;
interval.reset(); interval.reset();
} }
} }