crypto: Add missing flush calls to the sled crypto store

master
Damir Jelić 2021-02-16 10:29:10 +01:00
parent 1db89741bc
commit ef5d7ca579
1 changed files with 4 additions and 5 deletions

View File

@ -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(())
}