@@ -4,6 +4,7 @@ use anyhow::Context as _;
4
4
use hashbrown:: HashSet ;
5
5
use serde:: Deserialize ;
6
6
7
+ use database:: ArtifactId ;
7
8
use regex:: Regex ;
8
9
use reqwest:: header:: USER_AGENT ;
9
10
use std:: { sync:: Arc , time:: Duration } ;
@@ -583,13 +584,33 @@ where
583
584
pub async fn post_finished ( data : & InputData ) {
584
585
let conn = data. conn ( ) . await ;
585
586
let index = data. index . load ( ) ;
586
- let commits = index
587
+ let mut commits = index
587
588
. commits ( )
588
589
. into_iter ( )
589
590
. map ( |c| c. sha . to_string ( ) )
590
591
. collect :: < HashSet < _ > > ( ) ;
591
592
let queued = conn. queued_commits ( ) . await ;
592
593
594
+ // In theory this is insufficient -- there could be multiple commits in
595
+ // progress -- but in practice that really shouldn't happen.
596
+ //
597
+ // The failure case here is also just prematurely posting a single comment,
598
+ // which should be fine. mark_complete below will ensure that only happens
599
+ // once.
600
+ //
601
+ // If this becomes more of a problem, it should be fairly easy to instead
602
+ // query that there are no in progress benchmarks for commit X.
603
+ match conn. in_progress_artifact ( ) . await {
604
+ None => { }
605
+ Some ( ArtifactId :: Commit ( c) ) => {
606
+ commits. insert ( c. sha ) ;
607
+ }
608
+ Some ( ArtifactId :: Artifact ( _) ) => {
609
+ // do nothing, for now, though eventually we'll want an artifact
610
+ // queue
611
+ }
612
+ }
613
+
593
614
for commit in queued {
594
615
if !commits. contains ( & commit. sha ) {
595
616
continue ;
0 commit comments