Skip to content

Commit dd85cb9

Browse files
committed
fix(hm-pipeline-ir): satisfy fmt/clippy/test for typed timeout_seconds
1 parent 46303d7 commit dd85cb9

1 file changed

Lines changed: 18 additions & 21 deletions

File tree

crates/hm-exec/src/local/scheduler.rs

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -265,26 +265,23 @@ pub(crate) async fn run(
265265
// set twice: once racing the deadline (to fire cancellation promptly), then
266266
// again to drain every step to completion before tearing down.
267267
let pending: Vec<StepFuture> = done.into_values().collect();
268-
let timed_out = match pipeline_timeout {
269-
Some(secs) if secs > 0 => {
270-
let join_fut = join_all(pending.clone());
271-
tokio::pin!(join_fut);
272-
tokio::select! {
273-
_ = &mut join_fut => false,
274-
() = tokio::time::sleep(Duration::from_secs(u64::from(secs))) => {
275-
// Whole-build budget blown: signal every step to stop. New
276-
// steps short-circuit via the `cancel.is_cancelled()` check
277-
// in the spawn closure; in-flight runners observe
278-
// run_ctx.cancel.
279-
cancel.cancel();
280-
true
281-
}
268+
let timed_out = if let Some(secs) = pipeline_timeout {
269+
let join_fut = join_all(pending.clone());
270+
tokio::pin!(join_fut);
271+
tokio::select! {
272+
_ = &mut join_fut => false,
273+
() = tokio::time::sleep(Duration::from_secs(u64::from(secs.get()))) => {
274+
// Whole-build budget blown: signal every step to stop. New
275+
// steps short-circuit via the `cancel.is_cancelled()` check
276+
// in the spawn closure; in-flight runners observe
277+
// run_ctx.cancel.
278+
cancel.cancel();
279+
true
282280
}
283281
}
284-
_ => {
285-
let _ = join_all(pending.clone()).await;
286-
false
287-
}
282+
} else {
283+
let _ = join_all(pending.clone()).await;
284+
false
288285
};
289286
let outcomes: Vec<StepOutcome> = join_all(pending).await;
290287
let any_failed = outcomes.iter().any(|o| o.exit_code != 0);
@@ -303,7 +300,7 @@ pub(crate) async fn run(
303300

304301
if timed_out {
305302
tracing::warn!(
306-
timeout_seconds = pipeline_timeout,
303+
timeout_seconds = ?pipeline_timeout,
307304
"pipeline wall-clock timeout exceeded; build failed"
308305
);
309306
}
@@ -445,8 +442,8 @@ async fn execute_step(
445442

446443
let exec = runner.execute(&run_ctx, input);
447444
let result: anyhow::Result<StepResult> = match step_timeout_secs {
448-
Some(secs) if secs > 0 => {
449-
match tokio::time::timeout(Duration::from_secs(u64::from(secs)), exec).await {
445+
Some(secs) => {
446+
match tokio::time::timeout(Duration::from_secs(u64::from(secs.get())), exec).await {
450447
Ok(r) => r,
451448
Err(_elapsed) => {
452449
// Per-step wall-clock budget exceeded. Emit a step-end with the

0 commit comments

Comments
 (0)