Signed-off-by: mujunxiang <1948535941@qq.com>
This commit is contained in:
mujunxiang
2024-11-19 17:30:50 +08:00
parent e94d462652
commit ec8b73bd9c
2 changed files with 33 additions and 35 deletions
+4 -2
View File
@@ -514,7 +514,9 @@ impl FolderScanner {
let this_hash = hash_path(&folder.name); let this_hash = hash_path(&folder.name);
let was_compacted = into.compacted; let was_compacted = into.compacted;
loop { // do not really loop
let mut times = 1;
while times > 0 {
let mut abandoned_children: DataUsageHashMap = if !into.compacted { let mut abandoned_children: DataUsageHashMap = if !into.compacted {
self.old_cache.find_children_copy(this_hash.clone()) self.old_cache.find_children_copy(this_hash.clone())
} else { } else {
@@ -902,7 +904,7 @@ impl FolderScanner {
scan(&this, into, self).await; scan(&this, into, self).await;
} }
} }
break; times -= 1;
} }
if !was_compacted { if !was_compacted {
self.new_cache.replace_hashed(&this_hash, &Some(folder.parent.clone()), into); self.new_cache.replace_hashed(&this_hash, &Some(folder.parent.clone()), into);
+29 -33
View File
@@ -326,44 +326,40 @@ impl HealSequence {
count count
}; };
loop { match resp_rx.recv().await {
match resp_rx.recv().await { Some(mut res) => {
Some(mut res) => { if res.err.is_none() {
if res.err.is_none() { self.count_healed(heal_type.clone());
self.count_healed(heal_type.clone()); } else {
} else { self.count_failed(heal_type.clone());
self.count_failed(heal_type.clone()); }
} if !self.report_progress {
if !self.report_progress { if let Some(err) = res.err {
if let Some(err) = res.err { if err.to_string() == ERR_SKIP_FILE {
if err.to_string() == ERR_SKIP_FILE {
return Ok(());
}
return Err(err);
} else {
return Ok(()); return Ok(());
} }
return Err(err);
} else {
return Ok(());
} }
res.result.heal_item_type = heal_type.clone();
if let Some(err) = res.err.as_ref() {
res.result.detail = err.to_string();
}
if res.result.parity_blocks > 0
&& res.result.data_blocks > 0
&& res.result.data_blocks > res.result.parity_blocks
{
let got = count_ok_drives(&res.result.after);
if got < res.result.parity_blocks {
res.result.detail = format!(
"quorum loss - expected {} minimum, got drive states in OK {}",
res.result.parity_blocks, got
);
}
}
return self.push_heal_result_item(&res.result).await;
} }
None => return Ok(()), res.result.heal_item_type = heal_type.clone();
if let Some(err) = res.err.as_ref() {
res.result.detail = err.to_string();
}
if res.result.parity_blocks > 0 && res.result.data_blocks > 0 && res.result.data_blocks > res.result.parity_blocks
{
let got = count_ok_drives(&res.result.after);
if got < res.result.parity_blocks {
res.result.detail = format!(
"quorum loss - expected {} minimum, got drive states in OK {}",
res.result.parity_blocks, got
);
}
}
return self.push_heal_result_item(&res.result).await;
} }
None => return Ok(()),
} }
} }