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

Commit

Permalink
feat: Synchronously flush sled DB rather than using sled::Tree::flush…
Browse files Browse the repository at this point in the history
…_async, which can cause deadlocks. Fixes #403 (#540)
  • Loading branch information
jsantell authored Jul 29, 2023
1 parent fcbe36c commit 7262d5c
Showing 1 changed file with 5 additions and 1 deletion.
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(())
}
}

0 comments on commit 7262d5c

Please sign in to comment.