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.

Reminders: one sync pass at a time, as Notes now has, so an older pass cannot store over a newer write

Yashwanth Kamireddi7a5077443f89
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 5328da6..5564a28 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -71,6 +71,10 @@ async fn resync_reminders(
/// screen wait on Apple: when CloudKit was slow or overloaded (503, retry in 10s), Reminders,
/// Notes and the rest drew nothing at all until it gave up. The fetch runs unlocked; the
/// library is held only to store what came back.
+/// One reminders pass at a time, for the reason [`NOTES_PASS`] gives: an older pass storing
+/// after a newer write put the reminder back as it was before the write.
+pub static REMINDERS_PASS: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());
+
async fn refresh_reminders(
http: &reqwest::Client,
root: &str,
@@ -78,6 +82,7 @@ async fn refresh_reminders(
data: &State<'_, Data>,
whole: bool,
) -> Result<(), String> {
+ let _one = REMINDERS_PASS.lock().await;
let since = if whole {
None
} else {
diff --git a/src-tauri/src/refresh.rs b/src-tauri/src/refresh.rs
index 8a621b2..de33bf8 100644
--- a/src-tauri/src/refresh.rs
+++ b/src-tauri/src/refresh.rs
@@ -161,6 +161,7 @@ pub async fn all(client: &Arc<Mutex<Client>>, data: &Mutex<Library>) -> Refresh
reports.push(match ctx.cloudkit.as_deref() {
None => unavailable("reminders", "Reminders"),
Some(root) => {
+ let _one = crate::REMINDERS_PASS.lock().await;
let since = token(data, "reminders").await;
let full = since.is_none();
let fetched = quince_icloud::reminders::fetch_cloudkit(