0.1.2: stop retrying vaults that were left or forgotten

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 14:41:55 +07:00
parent 4f6414b256
commit 584b279496
4 changed files with 13 additions and 6 deletions

View File

@@ -229,7 +229,7 @@ pub fn leave_hub(config: &mut Config, url: &str, forget: bool) -> Result<Vec<Str
}
Err(_) => said.push(format!("Couldn't reach {url}, so this device only forgot it; its folders stay, no longer synced")),
}
for vc in config.vaults.iter().filter(|v| v.hub_url.as_deref() == Some(url)) {
for vc in config.vaults.iter().filter(|v| v.hub_url.as_deref() == Some(url) && v.path.exists()) {
let _ = set_read_only(&vc.path, false);
said.push(format!("{} stays at {}, no longer synced", vc.name, vc.path.display()));
}

View File

@@ -72,8 +72,15 @@ pub fn supervise(log: fn(&str, &str)) -> Result<()> {
return;
}
Err(e) => {
// A vault that's no longer in the settings (left, forgotten) isn't retried.
if !Config::load().is_ok_and(|c| c.vaults.iter().any(|v| v.path == cfg.path)) {
return;
}
log(&cfg.name, &format!("stopped: {e:#} — retrying in 30 s"));
std::thread::sleep(Duration::from_secs(30));
if !Config::load().is_ok_and(|c| c.vaults.iter().any(|v| v.path == cfg.path)) {
return;
}
}
}
}