Skip to content

Commit

Permalink
Only fetch metadata for files for a speedup
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed May 30, 2021
1 parent ffdb0c2 commit d381c6c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub fn aggregate(
num_errors += 1;
0
}
None => unreachable!("must have populated client state for metadata"),
None => 0, // ignore directory
} as u128;
stats.largest_file_in_bytes = stats.largest_file_in_bytes.max(file_size);
stats.smallest_file_in_bytes = stats.smallest_file_in_bytes.min(file_size);
Expand Down
4 changes: 3 additions & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ impl WalkOptions {
.process_read_dir(|_, _, _, dir_entry_results| {
dir_entry_results.iter_mut().for_each(|dir_entry_result| {
if let Ok(dir_entry) = dir_entry_result {
dir_entry.client_state = Some(dir_entry.metadata());
if dir_entry.file_type.is_file() {
dir_entry.client_state = Some(dir_entry.metadata());
}
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl Traversal {
data.metadata_io_error = true;
0
}
None => unreachable!("must have populated client state for metadata"),
None => 0, // a directory
} as u128;

match (entry.depth, previous_depth) {
Expand Down

0 comments on commit d381c6c

Please sign in to comment.