Skip to content

Commit 084e79a

Browse files
committed
fix: apply acceptable bounds into max-parallelism
1 parent ace1057 commit 084e79a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/cli/src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::{anyhow, bail, Error};
44
use base::commands::start_server;
55
use base::rt_worker::worker_pool::{SupervisorPolicy, WorkerPoolPolicy};
66
use base::server::WorkerEntrypoints;
7-
use clap::builder::FalseyValueParser;
7+
use clap::builder::{FalseyValueParser, TypedValueParser};
88
use clap::{arg, crate_version, value_parser, ArgAction, Command};
99
use deno_core::url::Url;
1010
use sb_graph::emitter::EmitterFactory;
@@ -65,7 +65,12 @@ fn cli() -> Command {
6565
)
6666
.arg(
6767
arg!(--"max-parallelism" <COUNT> "Maximum count of workers that can exist in the worker pool simultaneously")
68-
.value_parser(value_parser!(usize))
68+
.value_parser(
69+
// NOTE: Acceptable bounds were chosen arbitrarily.
70+
value_parser!(u32)
71+
.range(1..9999)
72+
.map(|it| -> usize { it as usize })
73+
)
6974
)
7075
.arg(
7176
arg!(--"request-wait-timeout" <MILLISECONDS> "Maximum time in milliseconds that can wait to establish a connection with a worker")

0 commit comments

Comments
 (0)