From e6c09074d34ebaf28037257cc635d52b9534872f Mon Sep 17 00:00:00 2001 From: Lennart <18233294+lennart-k@users.noreply.github.com> Date: Wed, 15 Jan 2025 21:02:53 +0100 Subject: [PATCH] Resolve deadlocks (I'm an idiot) --- crates/store_sqlite/src/addressbook_store.rs | 3 ++- crates/store_sqlite/src/calendar_store.rs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/store_sqlite/src/addressbook_store.rs b/crates/store_sqlite/src/addressbook_store.rs index 81455e0..0452f6e 100644 --- a/crates/store_sqlite/src/addressbook_store.rs +++ b/crates/store_sqlite/src/addressbook_store.rs @@ -363,6 +363,8 @@ impl AddressbookStore for SqliteAddressbookStore { .await .map_err(crate::Error::from)?; + tx.commit().await.map_err(crate::Error::from)?; + // TODO: Watch for errors here? let _ = self.sender.try_send(CollectionOperation { r#type: CollectionOperationType::Object, @@ -374,7 +376,6 @@ impl AddressbookStore for SqliteAddressbookStore { sync_token: Some(synctoken), }); - tx.commit().await.map_err(crate::Error::from)?; Ok(()) } diff --git a/crates/store_sqlite/src/calendar_store.rs b/crates/store_sqlite/src/calendar_store.rs index fc24200..91814e2 100644 --- a/crates/store_sqlite/src/calendar_store.rs +++ b/crates/store_sqlite/src/calendar_store.rs @@ -308,6 +308,8 @@ impl CalendarStore for SqliteCalendarStore { ) .await?; + tx.commit().await.map_err(crate::Error::from)?; + // TODO: Watch for errors here? let _ = self.sender.try_send(CollectionOperation { r#type: CollectionOperationType::Object, @@ -315,8 +317,6 @@ impl CalendarStore for SqliteCalendarStore { topic: self.get_calendar(&principal, &cal_id).await?.push_topic, sync_token: Some(synctoken), }); - - tx.commit().await.map_err(crate::Error::from)?; Ok(()) }