Skip to content

Commit 316e314

Browse files
committed
update index & update test
1 parent 2e2159f commit 316e314

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

database/src/pool/postgres.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static MIGRATIONS: &[&str] = &[
305305
r#"ALTER TABLE benchmark_request ALTER COLUMN tag DROP NOT NULL;"#,
306306
// Prevent multiple try commits without a `sha` and the same `pr` number
307307
// being added to the table
308-
r#"CREATE UNIQUE INDEX benchmark_request_pr_commit_type_idx ON benchmark_request (pr, commit_type) WHERE tag IS NULL;"#,
308+
r#"CREATE UNIQUE INDEX benchmark_request_pr_commit_type_idx ON benchmark_request (pr, commit_type) WHERE status != 'completed';"#,
309309
];
310310

311311
#[async_trait::async_trait]

site/src/job_queue.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -428,23 +428,23 @@ mod tests {
428428
* +------------+
429429
* | r "v1.2.3" |
430430
* +------------+
431+
*
432+
*
433+
*
431434
* 1: Currently `in_progress`
432-
* +---------------+
433-
* +--->| t "t1" IP pr1 |
434-
* | +---------------+
435-
* +-----------+ |
436-
* | m "rrr" C | -----+-->
437-
* +-----------+ |
438-
* | +---------------+
439-
* +--->| t "yee" R pr1 | 3: a try with a low pr
440-
* +---------------+
435+
* +-----------+ +---------------+
436+
* | m "rrr" C | -----+--->| t "t1" IP pr1 |
437+
* +-----------+ +---------------+
438+
*
439+
*
440+
*
441441
* +-----------+
442442
* | m "aaa" C |
443443
* +-----------+
444444
* |
445445
* V
446446
* +----------------+
447-
* | m "mmm" R pr88 | 6: a master commit
447+
* | m "mmm" R pr88 | 5: a master commit
448448
* +----------------+
449449
*
450450
* +-----------+
@@ -453,7 +453,7 @@ mod tests {
453453
* |
454454
* V
455455
* +----------------+
456-
* | m "123" R pr11 | 4: a master commit, high pr number
456+
* | m "123" R pr11 | 3: a master commit, high pr number
457457
* +----------------+
458458
*
459459
*
@@ -463,12 +463,12 @@ mod tests {
463463
* |
464464
* V
465465
* +----------------+
466-
* | m "foo" R pr77 | 5: a master commit
466+
* | m "foo" R pr77 | 4: a master commit
467467
* +----------------+
468468
* |
469469
* V
470470
* +---------------+
471-
* | t "baz" R pr4 | 7: a try with a low pr, blocked by parent
471+
* | t "baz" R pr4 | 6: a try with a low pr, blocked by parent
472472
* +---------------+
473473
*
474474
* The master commits should take priority, then "yee" followed
@@ -481,7 +481,6 @@ mod tests {
481481
create_master("123", "345", 11, "days2"),
482482
create_try("baz", "foo", 4, "days1"),
483483
create_release("v.1.2.3", "days2"),
484-
create_try("yee", "rrr", 1, "days2"), // lower PR number takes priority
485484
create_try("t1", "rrr", 1, "days1").with_status(BenchmarkRequestStatus::InProgress),
486485
create_master("mmm", "aaa", 88, "days2"),
487486
];
@@ -497,10 +496,7 @@ mod tests {
497496

498497
let sorted: Vec<BenchmarkRequest> = build_queue(&mut *db, &completed).await.unwrap();
499498

500-
queue_order_matches(
501-
&sorted,
502-
&["t1", "v.1.2.3", "yee", "123", "foo", "mmm", "baz"],
503-
);
499+
queue_order_matches(&sorted, &["t1", "v.1.2.3", "123", "foo", "mmm", "baz"]);
504500
Ok(ctx)
505501
})
506502
.await;

0 commit comments

Comments
 (0)