[router] Add Rust CLI flags for queue size, timeout, and rate limit for token bucket rate limiter (#11483)

Co-authored-by: Simo Lin <linsimo.mark@gmail.com>
This commit is contained in:
Jonah Bernard
2025-10-13 14:08:48 -04:00
committed by GitHub
parent 5e3f7e7fa9
commit f4aa78801e
3 changed files with 35 additions and 3 deletions

View File

@@ -205,6 +205,24 @@ impl ConfigValidator {
});
}
if config.queue_size > 0 && config.queue_timeout_secs == 0 {
return Err(ConfigError::InvalidValue {
field: "queue_timeout_secs".to_string(),
value: config.queue_timeout_secs.to_string(),
reason: "Must be > 0 when queue_size > 0".to_string(),
});
}
if let Some(tokens_per_second) = config.rate_limit_tokens_per_second {
if tokens_per_second <= 0 {
return Err(ConfigError::InvalidValue {
field: "rate_limit_tokens_per_second".to_string(),
value: tokens_per_second.to_string(),
reason: "Must be > 0 when specified".to_string(),
});
}
}
if config.worker_startup_timeout_secs == 0 {
return Err(ConfigError::InvalidValue {
field: "worker_startup_timeout_secs".to_string(),