MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / validate_grpc_rate_limit_args

Function validate_grpc_rate_limit_args

crates/openshell-server/src/cli.rs:665–682  ·  view source on GitHub ↗
(requests: Option<u64>, window_seconds: Option<u64>)

Source from the content-addressed store, hash-verified

663}
664
665fn validate_grpc_rate_limit_args(requests: Option<u64>, window_seconds: Option<u64>) -> Result<()> {
666 let disabled = matches!(requests, Some(0)) || matches!(window_seconds, Some(0));
667 if disabled {
668 return Ok(());
669 }
670 if matches!(
671 (requests, window_seconds),
672 (Some(requests), None) if requests > 0
673 ) || matches!(
674 (requests, window_seconds),
675 (None, Some(window_seconds)) if window_seconds > 0
676 ) {
677 return Err(miette::miette!(
678 "gRPC rate limiting requires both --grpc-rate-limit-requests and --grpc-rate-limit-window-seconds (TOML keys grpc_rate_limit_requests and grpc_rate_limit_window_seconds) to be positive; set either value to 0 to disable"
679 ));
680 }
681 Ok(())
682}
683
684fn normalize_compute_driver_socket_args(args: &mut RunArgs, matches: &ArgMatches) -> Result<()> {
685 let Some(socket) = args.compute_driver_socket.as_ref() else {

Callers 1

prepare_server_configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected