shorten file lifetime, maybe that helps?

This commit is contained in:
Folkert 2022-07-22 15:23:36 +02:00
parent dad0336d71
commit da6a6dcf1c
No known key found for this signature in database
GPG Key ID: 1F17F6FFD112B97C

View File

@ -1931,12 +1931,14 @@ pub fn surgery(
) {
let total_start = SystemTime::now();
let loading_metadata_start = total_start;
let input = fs::File::open(metadata_filename).unwrap_or_else(|e| internal_error!("{}", e));
let input = BufReader::new(input);
let md: metadata::Metadata = match deserialize_from(input) {
Ok(data) => data,
Err(err) => {
internal_error!("Failed to deserialize metadata: {}", err);
let md: metadata::Metadata = {
let input = fs::File::open(metadata_filename).unwrap_or_else(|e| internal_error!("{}", e));
let input = BufReader::new(input);
match deserialize_from(input) {
Ok(data) => data,
Err(err) => {
internal_error!("Failed to deserialize metadata: {}", err);
}
}
};
let loading_metadata_duration = loading_metadata_start.elapsed().unwrap();