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

8
Cargo.lock generated
View File

@@ -2581,7 +2581,7 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
[[package]] [[package]]
name = "lune-core" name = "lune-core"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.23.1", "base64 0.23.1",
@@ -2601,7 +2601,7 @@ dependencies = [
[[package]] [[package]]
name = "lune-desktop" name = "lune-desktop"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@@ -2621,7 +2621,7 @@ dependencies = [
[[package]] [[package]]
name = "lunehub" name = "lunehub"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"axum", "axum",
@@ -2642,7 +2642,7 @@ dependencies = [
[[package]] [[package]]
name = "lunesync" name = "lunesync"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",

View File

@@ -4,4 +4,4 @@ members = ["core", "cli", "hub", "desktop"]
# One version for every part: the hub offers clients by it (D3). # One version for every part: the hub offers clients by it (D3).
[workspace.package] [workspace.package]
version = "0.1.1" version = "0.1.2"

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")), 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); let _ = set_read_only(&vc.path, false);
said.push(format!("{} stays at {}, no longer synced", vc.name, vc.path.display())); 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; return;
} }
Err(e) => { 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")); log(&cfg.name, &format!("stopped: {e:#} — retrying in 30 s"));
std::thread::sleep(Duration::from_secs(30)); std::thread::sleep(Duration::from_secs(30));
if !Config::load().is_ok_and(|c| c.vaults.iter().any(|v| v.path == cfg.path)) {
return;
}
} }
} }
} }