Skip to content

Commit 5ad7fa5

Browse files
committed
Add a pool timeout to try to fix open File descriptor issue like deno
1 parent 34a0428 commit 5ad7fa5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

engine/baml-runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ colored = { version = "2.1.0", default-features = false, features = [
137137
] }
138138
futures-timer = { version = "3.0.3", features = ["wasm-bindgen"] }
139139
js-sys = "=0.3.69"
140-
reqwest = { version = "0.12.12", features = [
140+
reqwest = { version = "0.12.22", features = [
141141
"stream",
142142
"json",
143143
"native-tls-vendored",

engine/baml-runtime/src/request/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ fn builder() -> reqwest::ClientBuilder {
1414
.connect_timeout(Duration::from_secs(10))
1515
.danger_accept_invalid_certs(danger_accept_invalid_certs)
1616
.http2_keep_alive_interval(Some(Duration::from_secs(10)))
17-
// We don't want to keep idle connections around due to sometimes
18-
// causing a stall in the connection pool across FFI boundaries
17+
// To prevent stalling in python, we set the pool to 0 and idle timeout to 0.
18+
// See:
1919
// https://github.com/seanmonstar/reqwest/issues/600
20+
// https://github.com/denoland/deno/issues/28853
21+
// https://github.com/hyperium/hyper/issues/2312
22+
// https://github.com/Azure/azure-sdk-for-rust/pull/1550
2023
.pool_max_idle_per_host(0)
21-
24+
.pool_idle_timeout(std::time::Duration::from_nanos(1))
2225
}
2326
}
2427
}

0 commit comments

Comments
 (0)