Skip to content

Commit a5e33ea

Browse files
committed
PR feedback - updates to job_queue
1 parent 81814a0 commit a5e33ea

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

site/src/job_queue.rs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ fn sort_benchmark_requests<'a>(done: &HashSet<String>, request_queue: &'a mut [B
6060
// are ready to be benchmarked (i.e., those with parent in done or no
6161
// parent).
6262
let level_len = partition_in_place(request_queue[finished..].iter_mut(), |bmr| {
63-
matches!(bmr.commit_type, BenchmarkRequestType::Release { .. })
64-
|| bmr.parent_sha().is_none_or(|parent| done.contains(parent))
63+
bmr.parent_sha().is_none_or(|parent| done.contains(parent))
6564
});
6665

6766
// No commit is ready for benchmarking. This can happen e.g. when a try parent commit
@@ -294,18 +293,9 @@ mod tests {
294293
.cloned()
295294
}
296295

297-
fn queue_order_matches(queue: &[BenchmarkRequest], expected: &[&str]) -> bool {
296+
fn queue_order_matches(queue: &[BenchmarkRequest], expected: &[&str]) {
298297
let queue_shas: Vec<&str> = queue.iter().map(|req| req.tag()).collect();
299-
if queue_shas.len() != expected.len() {
300-
panic!("left: {:?} != right: {:?}", queue_shas, expected);
301-
} else {
302-
for (a, b) in queue_shas.iter().zip(expected) {
303-
if a != b {
304-
panic!("left: {:?} != right: {:?}", queue_shas, expected);
305-
}
306-
}
307-
return true;
308-
}
298+
assert_eq!(queue_shas, expected)
309299
}
310300

311301
trait BenchmarkRequestExt {
@@ -335,7 +325,7 @@ mod tests {
335325
.await;
336326
}
337327

338-
/// Parent completed < 30 d ago -> child is picked
328+
/// Parent completed -> child is picked
339329
#[tokio::test]
340330
async fn get_next_benchmark_request_completed_parent() {
341331
run_postgres_test(|ctx| async {
@@ -605,10 +595,10 @@ mod tests {
605595

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

608-
assert!(queue_order_matches(
598+
queue_order_matches(
609599
&sorted,
610-
&["t1", "v.1.2.3", "123", "foo", "mmm", "yee", "baz"]
611-
));
600+
&["t1", "v.1.2.3", "123", "foo", "mmm", "yee", "baz"],
601+
);
612602
Ok(ctx)
613603
})
614604
.await;

0 commit comments

Comments
 (0)