Skip to content

Commit

Permalink
fix?: use block_in_place for block_on
Browse files Browse the repository at this point in the history
  • Loading branch information
maan2003 committed Jan 18, 2024
1 parent 5a4df7a commit 28b0361
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions fedimint-server/src/atomic_broadcast/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ impl std::io::Write for UnitSaver {
}

fn flush(&mut self) -> std::io::Result<()> {
futures::executor::block_on(async {
let mut dbtx = self.db.begin_transaction().await;
tokio::task::block_in_place(|| {
futures::executor::block_on(async {
let mut dbtx = self.db.begin_transaction().await;

dbtx.insert_new_entry(&AlephUnitsKey(self.units_index), &self.buffer)
.await;
dbtx.insert_new_entry(&AlephUnitsKey(self.units_index), &self.buffer)
.await;

dbtx.commit_tx_result()
.await
.expect("This is the only place where we write to this key");
dbtx.commit_tx_result()
.await
.expect("This is the only place where we write to this key");
})
});

self.buffer.clear();
Expand Down

0 comments on commit 28b0361

Please sign in to comment.