From 584b27949652b8c6f3826ddda12e389f06dacd2c Mon Sep 17 00:00:00 2001 From: Adnan Zahir Date: Thu, 29 Oct 2026 14:41:55 +0700 Subject: [PATCH] 0.1.2: stop retrying vaults that were left or forgotten Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- core/src/membership.rs | 2 +- core/src/supervisor.rs | 7 +++++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5dcad81..97d5ca0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2581,7 +2581,7 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "lune-core" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "base64 0.23.1", @@ -2601,7 +2601,7 @@ dependencies = [ [[package]] name = "lune-desktop" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "chrono", @@ -2621,7 +2621,7 @@ dependencies = [ [[package]] name = "lunehub" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "axum", @@ -2642,7 +2642,7 @@ dependencies = [ [[package]] name = "lunesync" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 483751c..7aad9a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,4 +4,4 @@ members = ["core", "cli", "hub", "desktop"] # One version for every part: the hub offers clients by it (D3). [workspace.package] -version = "0.1.1" +version = "0.1.2" diff --git a/core/src/membership.rs b/core/src/membership.rs index a095a28..5733018 100644 --- a/core/src/membership.rs +++ b/core/src/membership.rs @@ -229,7 +229,7 @@ pub fn leave_hub(config: &mut Config, url: &str, forget: bool) -> Result 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())); } diff --git a/core/src/supervisor.rs b/core/src/supervisor.rs index 124fe05..b0cb412 100644 --- a/core/src/supervisor.rs +++ b/core/src/supervisor.rs @@ -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; + } } } }