Skip to main content

run_checks_parallel

Function run_checks_parallel 

Source
pub fn run_checks_parallel(checks: Vec<NamedCheck>) -> Vec<DiagnosticResult>
Expand description

Runs a collection of blocking checks in parallel with a per-check timeout.

Every check is scheduled on a worker thread; results are collected asynchronously as they finish. Individual failures never abort the batch: a check that panics or exceeds the timeout contributes a single CheckStatus::Fail diagnostic instead.

The order of the returned diagnostics is non-deterministic (checks finish at different times), so callers must not rely on the vector being sorted.

use limitless_cli::models::CheckStatus;
use limitless_cli::modules::diagnostics::{NamedCheck, run_checks_parallel};

let checks = vec![
    NamedCheck::single("Passing", || {
        limitless_cli::models::DiagnosticResult::new(
            "Passing",
            CheckStatus::Pass,
            "all good",
        )
    }),
];
let results = run_checks_parallel(checks);
assert_eq!(results.len(), 1);
assert!(results[0].is_pass());