Skip to content

Commit

Permalink
fix(iroh-bytes): ensure to flush file to disk (#1778)
Browse files Browse the repository at this point in the history
The content was not always on disk before emitting progress events and
returning, resulting in broken progress updates and unfinished writes.
  • Loading branch information
dignifiedquire authored Nov 8, 2023
1 parent 84ae95a commit 0987022
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions iroh-bytes/src/store/flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,8 @@ impl super::Store for Store {
offset += chunk.len() as u64;
progress.try_send(ImportProgress::CopyProgress { id, offset })?;
}
writer.flush().await?;
drop(writer);
let file = ImportFile::TempFile(temp_data_path);
rt.spawn_blocking(move || this.finalize_import_sync(file, format, id, progress))
.map(flatten_to_io)
Expand Down

0 comments on commit 0987022

Please sign in to comment.