@@ -39,9 +39,6 @@ async fn create_benchmark_request_master_commits(
3939/// Sorts try and master requests that are in the `ArtifactsReady` status.
4040/// Doesn't consider in-progress requests or release artifacts.
4141fn sort_benchmark_requests ( done : & HashSet < String > , request_queue : & mut [ BenchmarkRequest ] ) {
42- // A topological sort, where each "level" is additionally altered such that
43- // try commits come first, and then sorted by PR # (as a rough heuristic for
44- // earlier requests).
4542 let mut done: HashSet < String > = done. iter ( ) . cloned ( ) . collect ( ) ;
4643
4744 // Ensure all the items are ready to be sorted, if they are not this is
@@ -256,7 +253,7 @@ mod tests {
256253 fn create_try ( sha : & str , parent : & str , pr : u32 , age_days : & str ) -> BenchmarkRequest {
257254 BenchmarkRequest :: create_try (
258255 sha,
259- parent,
256+ Some ( parent) ,
260257 pr,
261258 days_ago ( age_days) ,
262259 BenchmarkRequestStatus :: ArtifactsReady ,
@@ -366,18 +363,18 @@ mod tests {
366363 . await ;
367364 }
368365
369- /// Parent exists but is > 30 d old -> parent gets picked
366+ /// Parent exists but is older -> parent gets picked
370367 #[ tokio:: test]
371368 async fn get_next_benchmark_request_oldest_first ( ) {
372369 run_postgres_test ( |ctx| async {
373370 let mut db = ctx. db_client ( ) . connection ( ) . await ;
374371 let c1 = create_master ( "x" , "x" , 1 , "days521" )
375372 . with_status ( BenchmarkRequestStatus :: Completed ) ;
376- let c2 = create_master ( "y" , "y" , 1 , "days521" )
373+ let c2 = create_master ( "y" , "y" , 2 , "days521" )
377374 . with_status ( BenchmarkRequestStatus :: Completed ) ;
378375
379- let m1 = create_master ( "old" , "x" , 2 , "days45" ) ;
380- let m2 = create_master ( "new" , "y" , 3 , "days1" ) ;
376+ let m1 = create_master ( "old" , "x" , 3 , "days45" ) ;
377+ let m2 = create_master ( "new" , "y" , 4 , "days1" ) ;
381378
382379 db_insert_requests ( & * db, & [ c1, c2, m1, m2] ) . await ;
383380 enqueue_next_job ( & mut * db) . await ?;
@@ -415,13 +412,13 @@ mod tests {
415412 run_postgres_test ( |ctx| async {
416413 let mut db = ctx. db_client ( ) . connection ( ) . await ;
417414 // Fresh parents that will unblock some children
418- let parent_master = create_master ( "parent_m" , "x" , 999 , "days5" )
415+ let parent_master = create_master ( "parent_m" , "x" , 911 , "days5" )
419416 . with_status ( BenchmarkRequestStatus :: Completed ) ;
420417 let parent_try = create_try ( "parent_t" , "x" , 888 , "days4" )
421418 . with_status ( BenchmarkRequestStatus :: Completed ) ;
422- let parent_master_two = create_master ( "gp" , "x" , 999 , "days5" )
419+ let parent_master_two = create_master ( "gp" , "x" , 922 , "days5" )
423420 . with_status ( BenchmarkRequestStatus :: Completed ) ;
424- let parent_master_three = create_master ( "blocked_p" , "x" , 999 , "days5" )
421+ let parent_master_three = create_master ( "blocked_p" , "x" , 932 , "days5" )
425422 . with_status ( BenchmarkRequestStatus :: Completed ) ;
426423
427424 // Two releases, the older one should win overall
@@ -468,21 +465,21 @@ mod tests {
468465 run_postgres_test ( |ctx| async {
469466 let mut db = ctx. db_client ( ) . connection ( ) . await ;
470467 // Fresh parents that will unblock some children
471- let parent_master = create_master ( "parent_m" , "x" , 999 , "days5" )
468+ let parent_master = create_master ( "parent_m" , "x" , 8 , "days5" )
472469 . with_status ( BenchmarkRequestStatus :: Completed ) ;
473- let parent_try = create_try ( "parent_t" , "x" , 888 , "days4" )
470+ let parent_try = create_try ( "parent_t" , "x" , 9 , "days4" )
474471 . with_status ( BenchmarkRequestStatus :: Completed ) ;
475- let parent_master_two = create_master ( "gp" , "x" , 999 , "days5" )
472+ let parent_master_two = create_master ( "gp" , "x" , 10 , "days5" )
476473 . with_status ( BenchmarkRequestStatus :: Completed ) ;
477- let parent_master_three = create_master ( "blocked_p" , "x" , 999 , "days5" )
474+ let parent_master_three = create_master ( "blocked_p" , "x" , 11 , "days5" )
478475 . with_status ( BenchmarkRequestStatus :: Completed ) ;
479476
480477 // Ready masters (parents completed)
481- let m1 = create_master ( "m_low" , "parent_m" , 1 , "days12" ) ;
478+ let m1 = create_master ( "m_low" , "parent_m" , 3 , "days12" ) ;
482479 let m2 = create_master ( "m_high" , "parent_m" , 7 , "days8" ) ;
483480
484- let m3 = create_master ( "B" , "gp" , 0 , "days3" ) ;
485- let m4 = create_master ( "C" , "blocked_p" , 0 , "days1" ) ;
481+ let m3 = create_master ( "B" , "gp" , 1 , "days3" ) ;
482+ let m4 = create_master ( "C" , "blocked_p" , 2 , "days1" ) ;
486483
487484 // A try commit that is ready
488485 let t1 = create_try ( "t_ready" , "parent_t" , 42 , "days2" ) ;
0 commit comments