diff --git a/crates/omnigraph-server/examples/bench_actor_isolation.rs b/crates/omnigraph-server/examples/bench_actor_isolation.rs index 96e9cec..c4ffd8d 100644 --- a/crates/omnigraph-server/examples/bench_actor_isolation.rs +++ b/crates/omnigraph-server/examples/bench_actor_isolation.rs @@ -158,7 +158,10 @@ async fn drive_heavy_actor( ) -> (usize, usize, usize) { use tokio::sync::Semaphore; - let limiter = Arc::new(Semaphore::new(concurrency.max(1))); + // Asserted at startup in `main()`; check again here for defense in + // depth so a future caller can't pass 0 silently. + assert!(concurrency > 0, "drive_heavy_actor concurrency must be > 0"); + let limiter = Arc::new(Semaphore::new(concurrency)); let mut handles = Vec::with_capacity(batches); for b in 0..batches { let app = app.clone(); @@ -251,6 +254,13 @@ async fn main() { eprintln!("--light-actors, --light-ops-per-actor, --heavy-batches must all be > 0"); std::process::exit(2); } + if args.heavy_concurrency == 0 { + eprintln!( + "--heavy-concurrency must be > 0 (zero would prevent the heavy actor from \ + ever firing a batch; if you want to disable heavy traffic, set --heavy-batches=0)" + ); + std::process::exit(2); + } let temp = tempfile::tempdir().expect("tempdir"); let repo = temp.path().join("bench.omni");