Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Pin Rust 1.98.1; drop the fetch_update newer Rust deprecates

Yashwanth Kamireddi0ee79e7b9966
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
new file mode 100644
index 0000000..863ef58
--- /dev/null
+++ b/rust-toolchain.toml
@@ -0,0 +1,6 @@
+# One Rust for every build — this machine, CI, Windows, the release — so a new stable release
+# can never fail a build that passed the day before. Moved forward on purpose, not by surprise.
+[toolchain]
+channel = "1.98.1"
+components = ["rustfmt", "clippy"]
+profile = "minimal"
diff --git a/src-tauri/src/photos.rs b/src-tauri/src/photos.rs
index d4d9c67..622d265 100644
--- a/src-tauri/src/photos.rs
+++ b/src-tauri/src/photos.rs
@@ -576,11 +576,15 @@ pub fn keep_ahead(app: AppHandle) {
}
if let Ok(path) = crate::cpu::ahead(cached(&app, &id, size)).await {
let len = tokio::fs::metadata(&path).await.map_or(0, |m| m.len());
- let _ = budget.fetch_update(
+ let mut b = budget.load(std::sync::atomic::Ordering::Relaxed);
+ while let Err(now) = budget.compare_exchange_weak(
+ b,
+ b.saturating_sub(len),
std::sync::atomic::Ordering::Relaxed,
std::sync::atomic::Ordering::Relaxed,
- |b| Some(b.saturating_sub(len)),
- );
+ ) {
+ b = now;
+ }
}
}
})