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 {
194
194
/// been completed yet. Pending statuses are `ArtifactsReady` and `InProgress`.
195
195
async fn load_pending_benchmark_requests ( & self ) -> anyhow:: Result < Vec < BenchmarkRequest > > ;
196
196
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.
198
199
async fn update_benchmark_request_status (
199
- & mut self ,
200
- request : & BenchmarkRequest ,
200
+ & self ,
201
+ tag : & str ,
201
202
status : BenchmarkRequestStatus ,
202
203
) -> anyhow:: Result < ( ) > ;
203
204
Original file line number Diff line number Diff line change @@ -1452,17 +1452,14 @@ where
1452
1452
}
1453
1453
1454
1454
async fn update_benchmark_request_status (
1455
- & mut self ,
1456
- request : & BenchmarkRequest ,
1455
+ & self ,
1456
+ tag : & str ,
1457
1457
status : BenchmarkRequestStatus ,
1458
1458
) -> 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
-
1463
1459
let status_str = status. as_str ( ) ;
1464
1460
let completed_at = status. completed_at ( ) ;
1465
- self . conn ( )
1461
+ let modified_rows = self
1462
+ . conn ( )
1466
1463
. execute (
1467
1464
r#"
1468
1465
UPDATE benchmark_request
@@ -1471,9 +1468,14 @@ where
1471
1468
& [ & status_str, & completed_at, & tag] ,
1472
1469
)
1473
1470
. 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
+ }
1477
1479
}
1478
1480
1479
1481
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 {
1281
1281
}
1282
1282
1283
1283
async fn update_benchmark_request_status (
1284
- & mut self ,
1285
- _request : & BenchmarkRequest ,
1284
+ & self ,
1285
+ _tag : & str ,
1286
1286
_status : BenchmarkRequestStatus ,
1287
1287
) -> anyhow:: Result < ( ) > {
1288
1288
no_queue_implementation_abort ! ( )
You can’t perform that action at this time.
0 commit comments