mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Buffer streamed file writes (#602)
This commit is contained in:
parent
0499fe0613
commit
f1c05dcd66
2 changed files with 9 additions and 5 deletions
|
@ -190,7 +190,8 @@ impl<'a, Context: BuildContext + Send + Sync> DistributionDatabase<'a, Context>
|
|||
|
||||
// Download the wheel into the cache.
|
||||
fs::create_dir_all(&cache_entry.dir).await?;
|
||||
let mut writer = fs::File::create(cache_entry.path()).await?;
|
||||
let mut writer =
|
||||
tokio::io::BufWriter::new(fs::File::create(cache_entry.path()).await?);
|
||||
tokio::io::copy(&mut reader.compat(), &mut writer).await?;
|
||||
|
||||
LocalWheel::Disk(DiskWheel {
|
||||
|
@ -221,7 +222,8 @@ impl<'a, Context: BuildContext + Send + Sync> DistributionDatabase<'a, Context>
|
|||
wheel.filename.to_string(),
|
||||
);
|
||||
fs::create_dir_all(&cache_entry.dir).await?;
|
||||
let mut writer = fs::File::create(&cache_entry.path()).await?;
|
||||
let mut writer =
|
||||
tokio::io::BufWriter::new(fs::File::create(&cache_entry.path()).await?);
|
||||
tokio::io::copy(&mut reader.compat(), &mut writer).await?;
|
||||
|
||||
let local_wheel = LocalWheel::Disk(DiskWheel {
|
||||
|
|
|
@ -584,9 +584,11 @@ impl<'a, T: BuildContext> SourceDistCachedBuilder<'a, T> {
|
|||
.map_err(puffin_client::Error::CacheWrite)?;
|
||||
let temp_dir = tempfile::tempdir_in(cache_dir).map_err(puffin_client::Error::CacheWrite)?;
|
||||
let sdist_file = temp_dir.path().join(source_dist_filename);
|
||||
let mut writer = tokio::fs::File::create(&sdist_file)
|
||||
.await
|
||||
.map_err(puffin_client::Error::CacheWrite)?;
|
||||
let mut writer = tokio::io::BufWriter::new(
|
||||
tokio::fs::File::create(&sdist_file)
|
||||
.await
|
||||
.map_err(puffin_client::Error::CacheWrite)?,
|
||||
);
|
||||
tokio::io::copy(&mut reader, &mut writer)
|
||||
.await
|
||||
.map_err(puffin_client::Error::CacheWrite)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue