File tree Expand file tree Collapse file tree 3 files changed +18
-15
lines changed Expand file tree Collapse file tree 3 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -194,10 +194,11 @@ pub trait Connection: Send + Sync {
194194 /// been completed yet. Pending statuses are `ArtifactsReady` and `InProgress`.
195195 async fn load_pending_benchmark_requests ( & self ) -> anyhow:: Result < Vec < BenchmarkRequest > > ;
196196
197- /// Update the status of a `benchmark_request`
197+ /// Update the status of a `benchmark_request` with the given `tag`.
198+ /// If no such request exists in the DB, returns an error.
198199 async fn update_benchmark_request_status (
199- & mut self ,
200- request : & BenchmarkRequest ,
200+ & self ,
201+ tag : & str ,
201202 status : BenchmarkRequestStatus ,
202203 ) -> anyhow:: Result < ( ) > ;
203204
Original file line number Diff line number Diff line change @@ -1452,17 +1452,14 @@ where
14521452 }
14531453
14541454 async fn update_benchmark_request_status (
1455- & mut self ,
1456- request : & BenchmarkRequest ,
1455+ & self ,
1456+ tag : & str ,
14571457 status : BenchmarkRequestStatus ,
14581458 ) -> anyhow:: Result < ( ) > {
1459- let tag = request
1460- . tag ( )
1461- . expect ( "Cannot update status of a benchmark request without a tag. Use `attach_shas_to_try_benchmark_request` instead." ) ;
1462-
14631459 let status_str = status. as_str ( ) ;
14641460 let completed_at = status. completed_at ( ) ;
1465- self . conn ( )
1461+ let modified_rows = self
1462+ . conn ( )
14661463 . execute (
14671464 r#"
14681465 UPDATE benchmark_request
@@ -1471,9 +1468,14 @@ where
14711468 & [ & status_str, & completed_at, & tag] ,
14721469 )
14731470 . await
1474- . context ( "failed to benchmark request status update" ) ?;
1475-
1476- Ok ( ( ) )
1471+ . context ( "failed to update benchmark request status" ) ?;
1472+ if modified_rows == 0 {
1473+ Err ( anyhow:: anyhow!(
1474+ "Could not update status of benchmark request with tag `{tag}`, it was not found."
1475+ ) )
1476+ } else {
1477+ Ok ( ( ) )
1478+ }
14771479 }
14781480
14791481 async fn attach_shas_to_try_benchmark_request (
Original file line number Diff line number Diff line change @@ -1281,8 +1281,8 @@ impl Connection for SqliteConnection {
12811281 }
12821282
12831283 async fn update_benchmark_request_status (
1284- & mut self ,
1285- _request : & BenchmarkRequest ,
1284+ & self ,
1285+ _tag : & str ,
12861286 _status : BenchmarkRequestStatus ,
12871287 ) -> anyhow:: Result < ( ) > {
12881288 no_queue_implementation_abort ! ( )
You can’t perform that action at this time.
0 commit comments