Skip to content

Commit

Permalink
store: use block_on from pollster when reading conflicts
Browse files Browse the repository at this point in the history
This avoids rust-lang/futures-rs#2090. I
don't think we need to worry about reading legacy conflicts
asynchronously - async is really only useful for Google's backend
right now, and we don't use the legacy format at Google. It's
unfortunate that we need another dependency just for this, but it's a
tiny crate at least.
  • Loading branch information
martinvonz committed Oct 28, 2023
1 parent a1ef9dc commit 47b40b1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ num_cpus = "1.16.0"
once_cell = "1.18.0"
pest = "2.7.5"
pest_derive = "2.7.5"
pollster = "0.3.0"
pretty_assertions = "1.4.0"
prost = "0.11.9"
prost-build = "0.11.9"
Expand Down
3 changes: 2 additions & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ harness = false
version_check = { workspace = true }

[dependencies]
async-trait = { workspace = true}
async-trait = { workspace = true }
backoff = { workspace = true }
blake2 = { workspace = true }
byteorder = { workspace = true }
Expand All @@ -37,6 +37,7 @@ maplit = { workspace = true }
once_cell = { workspace = true }
pest = { workspace = true }
pest_derive = { workspace = true }
pollster = { workspace = true }
prost = { workspace = true }
rand = { workspace = true }
rand_chacha = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion lib/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use std::io::Read;
use std::sync::{Arc, RwLock};

use futures::executor::block_on;
use pollster::FutureExt as _;

use crate::backend;
use crate::backend::{
Expand Down Expand Up @@ -229,7 +230,7 @@ impl Store {
path: &RepoPath,
id: &ConflictId,
) -> BackendResult<MergedTreeValue> {
let backend_conflict = block_on(self.backend.read_conflict(path, id))?;
let backend_conflict = self.backend.read_conflict(path, id).block_on()?;
Ok(Merge::from_backend_conflict(backend_conflict))
}

Expand Down

0 comments on commit 47b40b1

Please sign in to comment.