Skip to content

Commit

Permalink
Don't report non-existing index as an error
Browse files Browse the repository at this point in the history
This can be expected in some situations, like if the docs failed to build.
  • Loading branch information
Nemo157 authored and syphar committed Aug 9, 2023
1 parent 1912cad commit cf97a54
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,17 @@ pub(crate) fn source_archive_path(name: &str, version: &str) -> String {
#[instrument(skip(storage))]
fn migrate_one(storage: &Storage, archive_path: &str, tmpdir: &Path) -> Result<()> {
// this will also download the index if it doesn't exist locally
let local_index_filename = storage.get_index_filename(archive_path)?;
let local_index_filename = match storage.get_index_filename(archive_path) {
Ok(filename) => filename,
Err(err) => {
if err.is::<PathNotFoundError>() {
info!("index does not exist, skipping");
return Ok(());
} else {
return Err(err);
}
}
};

if archive_index::is_sqlite_file(&local_index_filename)? {
info!("index already in SQLite format, skipping");
Expand Down Expand Up @@ -632,17 +642,17 @@ pub fn migrate_old_archive_indexes(
for row in conn
.query_raw(
"
SELECT
SELECT
crates.name,
releases.version
FROM
FROM
crates
INNER JOIN releases ON releases.crate_id = crates.id
WHERE
releases.archive_storage = true AND
WHERE
releases.archive_storage = true AND
releases.build_status = true
ORDER BY
ORDER BY
crates.name,
releases.id
",
Expand Down

0 comments on commit cf97a54

Please sign in to comment.