@@ -216,7 +216,7 @@ impl SiteCtxt {
216
216
}
217
217
218
218
/// Returns the not yet tested published artifacts, sorted from newest to oldest.
219
- pub async fn missing_artifacts ( & self ) -> anyhow:: Result < Vec < String > > {
219
+ pub async fn missing_published_artifacts ( & self ) -> anyhow:: Result < Vec < String > > {
220
220
let artifact_list: String = reqwest:: get ( "https://static.rust-lang.org/manifests.txt" )
221
221
. await ?
222
222
. text ( )
@@ -230,7 +230,7 @@ impl SiteCtxt {
230
230
231
231
let index = self . index . load ( ) ;
232
232
let tested_artifacts: HashSet < _ > = index. artifacts ( ) . collect ( ) ;
233
- let in_progress_artifacts : HashSet < _ > = conn
233
+ let in_progress_tagged_artifacts : HashSet < _ > = conn
234
234
. in_progress_artifacts ( )
235
235
. await
236
236
. into_iter ( )
@@ -240,22 +240,18 @@ impl SiteCtxt {
240
240
} )
241
241
. collect ( ) ;
242
242
243
- // Gather published artifacts that are not yet tested and are not in progress
244
- let mut artifacts: Vec < String > = vec ! [ ] ;
245
-
246
- // Ignore too old artifacts
247
- for artifact in artifact_list
243
+ // Gather at most last 20 published artifacts that are not yet tested and
244
+ // are not in progress.
245
+ let artifacts: Vec < _ > = artifact_list
248
246
. lines ( )
249
247
. rev ( )
250
248
. filter_map ( parse_published_artifact_tag)
251
249
. take ( 20 )
252
- {
253
- if !tested_artifacts. contains ( artifact. as_str ( ) )
254
- && !in_progress_artifacts. contains ( & artifact)
255
- {
256
- artifacts. push ( artifact) ;
257
- }
258
- }
250
+ . filter ( |artifact| {
251
+ !tested_artifacts. contains ( artifact. as_str ( ) )
252
+ && !in_progress_tagged_artifacts. contains ( artifact. as_str ( ) )
253
+ } )
254
+ . collect ( ) ;
259
255
260
256
Ok ( artifacts)
261
257
}
@@ -755,4 +751,24 @@ mod tests {
755
751
)
756
752
) ;
757
753
}
754
+
755
+ #[ test]
756
+ fn parse_published_beta_artifact ( ) {
757
+ assert_eq ! (
758
+ parse_published_artifact_tag(
759
+ "static.rust-lang.org/dist/2022-08-15/channel-rust-beta.toml"
760
+ ) ,
761
+ Some ( "beta-2022-08-15" . to_string( ) )
762
+ ) ;
763
+ }
764
+
765
+ #[ test]
766
+ fn parse_published_stable_artifact ( ) {
767
+ assert_eq ! (
768
+ parse_published_artifact_tag(
769
+ "static.rust-lang.org/dist/2022-08-15/channel-rust-1.63.0.toml"
770
+ ) ,
771
+ Some ( "1.63.0" . to_string( ) )
772
+ ) ;
773
+ }
758
774
}
0 commit comments