File tree Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -224,15 +224,15 @@ pub trait Connection: Send + Sync {
224224 commit_date : DateTime < Utc > ,
225225 ) -> anyhow:: Result < ( ) > ;
226226
227- /// Add a benchmark job to the job queue and return its ID .
227+ /// Add a benchmark job to the job queue.
228228 async fn enqueue_benchmark_job (
229229 & self ,
230230 request_tag : & str ,
231231 target : Target ,
232232 backend : CodegenBackend ,
233233 profile : Profile ,
234234 benchmark_set : u32 ,
235- ) -> anyhow:: Result < u32 > ;
235+ ) -> anyhow:: Result < Option < u32 > > ;
236236
237237 /// Add a benchmark job which is explicitly using a `parent_sha` we split
238238 /// 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
18041804 backend : CodegenBackend ,
18051805 profile : Profile ,
18061806 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
18091810 . conn ( )
1810- . query_one (
1811+ . query (
18111812 r#"
18121813 INSERT INTO job_queue(
18131814 request_tag,
@@ -1832,7 +1833,11 @@ where
18321833 )
18331834 . await
18341835 . 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+ }
18361841 }
18371842
18381843 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 {
13351335 _backend : CodegenBackend ,
13361336 _profile : Profile ,
13371337 _benchmark_set : u32 ,
1338- ) -> anyhow:: Result < u32 > {
1338+ ) -> anyhow:: Result < Option < u32 > > {
13391339 no_queue_implementation_abort ! ( )
13401340 }
13411341
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ impl RequestBuilder {
4949 )
5050 . await
5151 . unwrap ( ) ;
52- self . jobs . push ( ( job. clone ( ) , id) ) ;
52+ self . jobs . push ( ( job. clone ( ) , id. unwrap ( ) ) ) ;
5353 }
5454 self
5555 }
You can’t perform that action at this time.
0 commit comments