[model-gateway] allow refill rate to be zero (#14030)

This commit is contained in:
Simo Lin
2025-11-26 17:15:27 -08:00
committed by GitHub
parent 6330d6641b
commit e9e90460ed
2 changed files with 69 additions and 4 deletions
+3 -2
View File
@@ -261,11 +261,12 @@ impl ConfigValidator {
}
if let Some(tokens_per_second) = config.rate_limit_tokens_per_second {
if tokens_per_second <= 0 {
// Allow 0 for pure concurrency limiting (semaphore behavior)
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(),
reason: "Must be >= 0 when specified".to_string(),
});
}
}