Skip to content

Commit

Permalink
remove unix dependency for file size (#27668)
Browse files Browse the repository at this point in the history
Fix call to file size fn to not be platform dependent.

GitOrigin-RevId: 0e47d9db959d4e86fb4c5c24867ae8fb03f911b3
  • Loading branch information
emmaling27 authored and Convex, Inc. committed Jul 8, 2024
1 parent ddd0b23 commit 5a6d356
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/search/src/incremental_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::{
BTreeSet,
},
iter::zip,
os::unix::fs::MetadataExt,
path::{
Path,
PathBuf,
Expand Down Expand Up @@ -470,7 +469,7 @@ pub async fn build_new_segment<RT: Runtime>(

fn get_size(path: &PathBuf) -> anyhow::Result<u64> {
if path.is_file() {
return Ok(path.metadata()?.size());
return Ok(path.metadata()?.len());
}
std::fs::read_dir(path)?.try_fold(0, |acc, curr| Ok(acc + get_size(&curr?.path())?))
}
Expand Down

0 comments on commit 5a6d356

Please sign in to comment.