@@ -83,9 +83,31 @@ impl<'a> DatabaseDB<'a> {
83
83
data : & ProgressData ,
84
84
encoding_type : EncodingType ,
85
85
) -> Fallible < ( ) > {
86
+ let krate = if let Some ( ( old, new) ) = & data. version {
87
+ // If we're updating the name of the crate (typically changing the hash we found on
88
+ // github) then we ought to also use that new name for marking the crate as complete.
89
+ // Otherwise, we leave behind the old (unversioned) name and end up running this crate
90
+ // many times, effectively never actually completing it.
91
+ self . update_crate_version ( ex, old, new) ?;
92
+
93
+ // sanity check that the previous name of the crate is the one we intended to run.
94
+ if old. id ( ) != data. result . krate . id ( ) {
95
+ log:: warn!(
96
+ "Storing result under {} despite job intended for {} (with wrong name old={})" ,
97
+ new. id( ) ,
98
+ data. result. krate. id( ) ,
99
+ old. id( ) ,
100
+ ) ;
101
+ }
102
+
103
+ new
104
+ } else {
105
+ & data. result . krate
106
+ } ;
107
+
86
108
self . store_result (
87
109
ex,
88
- & data . result . krate ,
110
+ krate,
89
111
& data. result . toolchain ,
90
112
& data. result . result ,
91
113
& base64:: engine:: general_purpose:: STANDARD
@@ -94,11 +116,7 @@ impl<'a> DatabaseDB<'a> {
94
116
encoding_type,
95
117
) ?;
96
118
97
- if let Some ( ( old, new) ) = & data. version {
98
- self . update_crate_version ( ex, old, new) ?;
99
- }
100
-
101
- self . mark_crate_as_completed ( ex, & data. result . krate ) ?;
119
+ self . mark_crate_as_completed ( ex, krate) ?;
102
120
103
121
Ok ( ( ) )
104
122
}
0 commit comments