Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ anyhow = { version = "1.0.75", features = [] } # for err
clap = { version = "4.2.1", features = ["derive"] } # cli
clap_derive = "4.2.0" # cli
csv = "1.3.0" # csv de/serialize
dua-core = "4.1.0" # for walking the file tree
dua-core = "4.2.0" # for walking the file tree
itertools = "0.15.0" # tools for iterating over iterable things
path-clean = "1.0.1" # Pathname#cleaname in Ruby
rayon = "1.10.0" # for parallel iteration
Expand Down
25 changes: 6 additions & 19 deletions src/packs/walk_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,28 +215,19 @@ pub(crate) fn walk_directory(
!excluded_dirs_ref.is_match(relative_path)
};

let dua_walk = dua_core::walk(
let walk = dua_core::walk(
&absolute_root,
// As many threads as rayon's, so RAYON_NUM_THREADS limits the walk too
rayon::current_num_threads(),
Order::Completion,
Options::default().skip_metadata(),
// With dua-core's default of 2, the workers stop each time this loop
// parses a package.yml (https://github.com/Byron/dua-cli/pull/413)
Options::default()
.skip_metadata()
.queued_batches_per_worker(128),
read_directory,
);

// dua-core's workers stop while a few batches wait for this loop, as they
// do each time it parses a package.yml, so this thread drains them. Once a
// release has `Options::queued_batches_per_worker`, set that instead
// (https://github.com/Byron/dua-cli/pull/413).
let (sender, walk) = std::sync::mpsc::channel();
let draining = std::thread::spawn(move || {
for entry in dua_walk {
if sender.send(entry).is_err() {
break;
}
}
});

// A file can come before the directory it's in, and before the
// package.yml there, so which package.yml each file belongs to is
// settled once the walk is done
Expand Down Expand Up @@ -337,10 +328,6 @@ pub(crate) fn walk_directory(
}
}

if let Err(panic) = draining.join() {
std::panic::resume_unwind(panic);
}

let package_ymls =
package_ymls_of_directories(directories, &package_ymls_in_directories);
let owning_package_yml_for_file = included_files_in_directories
Expand Down
Loading