Skip to content

Commit

Permalink
Merge pull request #100 from aclysma/aclysma/remove-tokio-deadlock-hack
Browse files Browse the repository at this point in the history
Remove workaround for deadlock caused by tokio "coop" feature
  • Loading branch information
kabergstrom authored Aug 28, 2021
2 parents dbb38b5 + aee046f commit ec646af
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions daemon/src/source_pair_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,24 +584,11 @@ impl<'a> SourcePairImport<'a> {
let import_op_ref = &mut import_op;
let imported = ctx
.scope(async move {
// TODO(dvd): Can this be replaced now that tokio is gone?
//This is broken on tokio 0.2.14 and later (concurrent file loads endlessly yield to
// each other.
// let mut f = File::open(source).await?;
// let result = importer
// .import_boxed(&mut f, metadata.importer_options, metadata.importer_state)
// .await;

// Non-async work-around
let mut f = std::fs::File::open(source)?;
let mut contents = vec![];
f.read_to_end(&mut contents)?;
let mut cursor = futures::io::Cursor::new(contents);

let mut f = async_fs::File::open(source).await?;
importer
.import_boxed(
import_op_ref,
&mut cursor,
&mut f,
metadata.importer_options,
metadata.importer_state,
)
Expand Down

0 comments on commit ec646af

Please sign in to comment.