Skip to content

Commit bdedd50

Browse files
committed
dist: hoist Executor creation up
1 parent 2d134dc commit bdedd50

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/dist/component/package.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ impl DirectoryPackage<temp::Dir> {
5959
unpack_without_first_dir(
6060
&mut archive,
6161
&temp_dir,
62-
dl_cfg.process.unpack_ram()?,
63-
dl_cfg.process.io_thread_count()?,
62+
get_executor(
63+
unpack_ram(IO_CHUNK_SIZE, dl_cfg.process.unpack_ram()?),
64+
dl_cfg.process.io_thread_count()?,
65+
),
6466
)
6567
.context("failed to extract package")?;
6668

@@ -275,13 +277,9 @@ enum DirStatus {
275277
fn unpack_without_first_dir<R: Read>(
276278
archive: &mut tar::Archive<R>,
277279
path: &Path,
278-
unpack_ram_budget: Option<usize>,
279-
io_thread_count: usize,
280+
mut io_executor: Box<dyn Executor>,
280281
) -> Result<()> {
281282
let entries = archive.entries()?;
282-
let unpack_ram = unpack_ram(IO_CHUNK_SIZE, unpack_ram_budget);
283-
let mut io_executor = get_executor(unpack_ram, io_thread_count);
284-
285283
let mut directories: HashMap<PathBuf, DirStatus> = HashMap::new();
286284
// Path is presumed to exist. Call it a precondition.
287285
directories.insert(path.to_owned(), DirStatus::Exists);

0 commit comments

Comments
 (0)