mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-15 09:12:18 +00:00
fix(gateway): read Python's KEEPALIVE_TIMEOUT for the forwarding pool
gateway.launch and proxy_cli both hand KEEPALIVE_TIMEOUT to uvicorn, and the Rust child inherits that environment, so reading the same variable keeps the two timeouts in step with no supervisor change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ba1f6164b7
commit
bf3bab34ad
1 changed files with 15 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ pub(super) struct ForwardSettings {
|
|||
pub host: String,
|
||||
pub port: u16,
|
||||
rust_log: Option<String>,
|
||||
litellm_forward_keepalive_timeout: u64,
|
||||
keepalive_timeout: u64,
|
||||
}
|
||||
|
||||
impl Default for ForwardSettings {
|
||||
|
|
@ -19,14 +19,14 @@ impl Default for ForwardSettings {
|
|||
host: "0.0.0.0".into(),
|
||||
port: 4000,
|
||||
rust_log: None,
|
||||
litellm_forward_keepalive_timeout: 5,
|
||||
keepalive_timeout: 5,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ForwardSettings {
|
||||
pub fn upstream_keepalive(&self) -> Duration {
|
||||
Duration::from_secs(self.litellm_forward_keepalive_timeout)
|
||||
Duration::from_secs(self.keepalive_timeout)
|
||||
}
|
||||
|
||||
pub fn log_level(&self) -> Level {
|
||||
|
|
@ -107,6 +107,18 @@ mod tests {
|
|||
)
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[case::uvicorn_default(&[], Duration::from_secs(5))]
|
||||
#[case::shared_with_python(&[("KEEPALIVE_TIMEOUT", "2")], Duration::from_secs(2))]
|
||||
fn forwarding_reads_the_keepalive_python_uses(
|
||||
#[case] variables: &[(&str, &str)],
|
||||
#[case] expected: Duration,
|
||||
) {
|
||||
let settings: ForwardSettings = parse(variables).unwrap();
|
||||
|
||||
assert_eq!(settings.upstream_keepalive(), expected);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn defaults_allow_startup_without_ui_credentials() {
|
||||
let settings: Settings = parse(&[]).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue