Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limit on connection pool to prevent stalling issues in pyo3 and other ffi boundaries #1027

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions engine/baml-runtime/src/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn builder() -> reqwest::ClientBuilder {
// regularly have requests that take multiple minutes, due to how
// long LLMs take
.connect_timeout(Duration::from_secs(10))
.danger_accept_invalid_certs(danger_accept_invalid_certs)
.danger_accept_invalid_certs(danger_accept_invalid_certs)
.http2_keep_alive_interval(Some(Duration::from_secs(10)))
}
}
Expand All @@ -27,9 +27,13 @@ pub(crate) fn create_tracing_client() -> Result<reqwest::Client> {
if #[cfg(target_arch = "wasm32")] {
let cb = builder();
} else {
let cb =builder()
let cb = builder()
// Wait up to 30s to send traces to the backend
.read_timeout(Duration::from_secs(30));
.read_timeout(Duration::from_secs(30))
// We don't want to keep idle connections around due to sometimes
// causing a stall in the connection pool across FFI boundaries
// https://github.com/seanmonstar/reqwest/issues/600
.pool_max_idle_per_host(0);
}
}

Expand Down
Loading