Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

feat: Synchronously flush sled DB #540

Merged
merged 1 commit into from
Jul 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion rust/noosphere-storage/src/implementation/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ impl Store for NativeStore {

/// Flushes pending writes if there are any
async fn flush(&self) -> Result<()> {
self.db.flush_async().await?;
// `flush_async()` can deadlock when simultaneous calls are performed.
// This occurs often in tests and fixed in `sled`'s main branch,
// but no cargo release since 2021.
// https://github.com/spacejam/sled/issues/1308
self.db.flush().map_err(anyhow::Error::from)?;
Ok(())
}
}