From ef5d7ca5794fa28c2ebc0dc5c35ed6e8b7a6141e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 16 Feb 2021 10:29:10 +0100 Subject: [PATCH] crypto: Add missing flush calls to the sled crypto store --- matrix_sdk_crypto/src/store/sled.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/matrix_sdk_crypto/src/store/sled.rs b/matrix_sdk_crypto/src/store/sled.rs index 6ad3b920..bf39fc34 100644 --- a/matrix_sdk_crypto/src/store/sled.rs +++ b/matrix_sdk_crypto/src/store/sled.rs @@ -426,11 +426,9 @@ impl CryptoStore for SledStore { } async fn save_account(&self, account: ReadOnlyAccount) -> Result<()> { - let pickle = account.pickle(self.get_pickle_mode()).await; - self.account - .insert("account".encode(), serde_json::to_vec(&pickle)?)?; - - Ok(()) + let mut changes = Changes::default(); + changes.account = Some(account); + self.save_changes(changes).await } async fn save_changes(&self, changes: Changes) -> Result<()> { @@ -569,6 +567,7 @@ impl CryptoStore for SledStore { async fn save_value(&self, key: String, value: String) -> Result<()> { self.values.insert(key.as_str().encode(), value.as_str())?; + self.inner.flush_async().await?; Ok(()) }