Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions src/results/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,31 @@ impl<'a> DatabaseDB<'a> {
data: &ProgressData,
encoding_type: EncodingType,
) -> Fallible<()> {
let krate = if let Some((old, new)) = &data.version {
// If we're updating the name of the crate (typically changing the hash we found on
// github) then we ought to also use that new name for marking the crate as complete.
// Otherwise, we leave behind the old (unversioned) name and end up running this crate
// many times, effectively never actually completing it.
self.update_crate_version(ex, old, new)?;

// sanity check that the previous name of the crate is the one we intended to run.
if old.id() != data.result.krate.id() {
log::warn!(
"Storing result under {} despite job intended for {} (with wrong name old={})",
new.id(),
data.result.krate.id(),
old.id(),
);
}

new
} else {
&data.result.krate
};

self.store_result(
ex,
&data.result.krate,
krate,
&data.result.toolchain,
&data.result.result,
&base64::engine::general_purpose::STANDARD
Expand All @@ -94,11 +116,7 @@ impl<'a> DatabaseDB<'a> {
encoding_type,
)?;

if let Some((old, new)) = &data.version {
self.update_crate_version(ex, old, new)?;
}

self.mark_crate_as_completed(ex, &data.result.krate)?;
self.mark_crate_as_completed(ex, krate)?;

Ok(())
}
Expand Down
Loading