Skip to content

Commit

Permalink
Finish temp download of version db
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff committed Oct 17, 2024
1 parent 7c8ccd3 commit 69fa34e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ mod tests {
pub fn update_version_db(paths: &GlobalPaths) -> Result<()> {
let old_last_version_db_update: Option<DateTime<Utc>>;
let direct_download_etags: Vec<(String, String)>;
let temp_versiondb_download_path: Option<TempPath>;
let mut temp_versiondb_download_path: Option<TempPath> = None;
let mut delete_old_version_db: bool = false;

{
Expand Down Expand Up @@ -1429,22 +1429,20 @@ pub fn update_version_db(paths: &GlobalPaths) -> Result<()> {
))
.with_context(|| "Failed to construct URL for version db download.")?;

let foo = tempfile::NamedTempFile::new_in(&paths.versiondb.parent().unwrap()).unwrap().into_temp_path()
let temp_path = tempfile::NamedTempFile::new_in(&paths.versiondb.parent().unwrap()).unwrap().into_temp_path();

download_versiondb(&onlineversiondburl.to_string(), &foo)
download_versiondb(&onlineversiondburl.to_string(), &temp_path)
.with_context(|| {
format!(
"Failed to download new version db from {}.",
onlineversiondburl
)
})?;

temp_versiondb_download_path = Some(foo);
temp_versiondb_download_path = Some(temp_path);
}
} else if local_dbversion.is_some() {
// If the bundled version is up-to-date we can delete any cached version db json file


delete_old_version_db = true;
}
}
Expand Down

0 comments on commit 69fa34e

Please sign in to comment.