@@ -658,6 +658,7 @@ pub async fn handle_self_profile(
658
658
let mut it = body. benchmark . rsplitn ( 2 , '-' ) ;
659
659
let bench_ty = it. next ( ) . ok_or ( format ! ( "no benchmark type" ) ) ?;
660
660
let bench_name = it. next ( ) . ok_or ( format ! ( "no benchmark name" ) ) ?;
661
+ let index = data. index . load ( ) ;
661
662
662
663
let sort_idx = body
663
664
. sort_idx
@@ -670,26 +671,33 @@ pub async fn handle_self_profile(
670
671
. set ( Tag :: Profile , selector:: Selector :: One ( bench_ty) )
671
672
. set ( Tag :: Cache , selector:: Selector :: One ( body. run_name . clone ( ) ) ) ;
672
673
673
- let mut commits = vec ! [ data
674
- . index
675
- . load( )
674
+ let mut commits = vec ! [ index
676
675
. commits( )
677
676
. iter( )
678
677
. find( |c| c. sha == * body. commit. as_str( ) )
679
- . cloned( )
680
- . ok_or( format!( "could not find commit {}" , body. commit) ) ?
681
- . into( ) ] ;
678
+ . map( |c| database:: ArtifactId :: Commit ( * c) )
679
+ . or_else( || {
680
+ index
681
+ . artifacts( )
682
+ . find( |a| * * a == body. commit)
683
+ . map( |a| database:: ArtifactId :: Artifact ( a. to_owned( ) ) )
684
+ } )
685
+ . ok_or( format!( "could not find artifact {}" , body. commit) ) ?] ;
682
686
683
687
if let Some ( bc) = & body. base_commit {
684
688
commits. push (
685
- data. index
686
- . load ( )
689
+ index
687
690
. commits ( )
688
691
. iter ( )
689
692
. find ( |c| c. sha == * bc. as_str ( ) )
690
- . cloned ( )
691
- . ok_or ( format ! ( "could not find base commit {}" , body. commit) ) ?
692
- . into ( ) ,
693
+ . map ( |c| database:: ArtifactId :: Commit ( * c) )
694
+ . or_else ( || {
695
+ index
696
+ . artifacts ( )
697
+ . find ( |a| * * a == * bc. as_str ( ) )
698
+ . map ( |a| database:: ArtifactId :: Artifact ( a. to_owned ( ) ) )
699
+ } )
700
+ . ok_or ( format ! ( "could not find artifact {}" , body. commit) ) ?,
693
701
) ;
694
702
}
695
703
@@ -716,13 +724,17 @@ pub async fn handle_self_profile(
716
724
cpu_response. next ( ) . unwrap ( ) . 1 ,
717
725
sp_response. next ( ) . unwrap ( ) . 1 ,
718
726
Some ( sort_idx) ,
719
- ) ?;
727
+ )
728
+ . map_err ( |e| format ! ( "{}: {}" , body. commit, e) ) ?;
720
729
let base_profile = if body. base_commit . is_some ( ) {
721
- Some ( get_self_profile_data (
722
- cpu_response. next ( ) . unwrap ( ) . 1 ,
723
- sp_response. next ( ) . unwrap ( ) . 1 ,
724
- None ,
725
- ) ?)
730
+ Some (
731
+ get_self_profile_data (
732
+ cpu_response. next ( ) . unwrap ( ) . 1 ,
733
+ sp_response. next ( ) . unwrap ( ) . 1 ,
734
+ None ,
735
+ )
736
+ . map_err ( |e| format ! ( "{}: {}" , body. base_commit. as_ref( ) . unwrap( ) , e) ) ?,
737
+ )
726
738
} else {
727
739
None
728
740
} ;
0 commit comments