File tree Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -224,15 +224,16 @@ pub trait Connection: Send + Sync {
224
224
commit_date : DateTime < Utc > ,
225
225
) -> anyhow:: Result < ( ) > ;
226
226
227
- /// Add a benchmark job to the job queue and return its ID.
227
+ /// Add a benchmark job to the job queue and returns its ID, if it was not
228
+ /// already in the DB previously.
228
229
async fn enqueue_benchmark_job (
229
230
& self ,
230
231
request_tag : & str ,
231
232
target : Target ,
232
233
backend : CodegenBackend ,
233
234
profile : Profile ,
234
235
benchmark_set : u32 ,
235
- ) -> anyhow:: Result < u32 > ;
236
+ ) -> anyhow:: Result < Option < u32 > > ;
236
237
237
238
/// Add a benchmark job which is explicitly using a `parent_sha` we split
238
239
/// this out to improve our error handling. A `parent_sha` may not have
Original file line number Diff line number Diff line change @@ -1804,10 +1804,11 @@ where
1804
1804
backend : CodegenBackend ,
1805
1805
profile : Profile ,
1806
1806
benchmark_set : u32 ,
1807
- ) -> anyhow:: Result < u32 > {
1808
- let row = self
1807
+ ) -> anyhow:: Result < Option < u32 > > {
1808
+ // This will return zero rows if the job already exists
1809
+ let rows = self
1809
1810
. conn ( )
1810
- . query_one (
1811
+ . query (
1811
1812
r#"
1812
1813
INSERT INTO job_queue(
1813
1814
request_tag,
@@ -1832,7 +1833,11 @@ where
1832
1833
)
1833
1834
. await
1834
1835
. context ( "failed to insert benchmark_job" ) ?;
1835
- Ok ( row. get :: < _ , i32 > ( 0 ) as u32 )
1836
+ if let Some ( row) = rows. first ( ) {
1837
+ return Ok ( Some ( row. get :: < _ , i32 > ( 0 ) as u32 ) ) ;
1838
+ } else {
1839
+ return Ok ( None ) ;
1840
+ }
1836
1841
}
1837
1842
1838
1843
async fn get_compile_test_cases_with_measurements (
Original file line number Diff line number Diff line change @@ -1335,7 +1335,7 @@ impl Connection for SqliteConnection {
1335
1335
_backend : CodegenBackend ,
1336
1336
_profile : Profile ,
1337
1337
_benchmark_set : u32 ,
1338
- ) -> anyhow:: Result < u32 > {
1338
+ ) -> anyhow:: Result < Option < u32 > > {
1339
1339
no_queue_implementation_abort ! ( )
1340
1340
}
1341
1341
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ impl RequestBuilder {
49
49
)
50
50
. await
51
51
. unwrap ( ) ;
52
- self . jobs . push ( ( job. clone ( ) , id) ) ;
52
+ self . jobs . push ( ( job. clone ( ) , id. unwrap ( ) ) ) ;
53
53
}
54
54
self
55
55
}
You can’t perform that action at this time.
0 commit comments