diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 01:11:29 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 01:11:29 +0100 |
| commit | 81c19a8a4f1c99f721d4c65fbcddcec6474b752b (patch) | |
| tree | 3b2320a40725420ef18669a15b1aa41e637e86c6 /src/openrouter | |
| parent | tts: bound the audio cache and request length (diff) | |
| download | senator-sperma-81c19a8a4f1c99f721d4c65fbcddcec6474b752b.tar.gz senator-sperma-81c19a8a4f1c99f721d4c65fbcddcec6474b752b.zip | |
http: add connect and request timeouts
Diffstat (limited to '')
| -rw-r--r-- | src/openrouter/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/openrouter/mod.rs b/src/openrouter/mod.rs index 1d3b443..1b2caf4 100644 --- a/src/openrouter/mod.rs +++ b/src/openrouter/mod.rs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | use std::time::Duration; | ||
| 2 | |||
| 1 | use tracing::info; | 3 | use tracing::info; |
| 2 | 4 | ||
| 3 | use reqwest::Client; | 5 | use reqwest::Client; |
| @@ -49,7 +51,11 @@ impl OpenRouterClient { | |||
| 49 | api_key, | 51 | api_key, |
| 50 | model, | 52 | model, |
| 51 | api_url, | 53 | api_url, |
| 52 | client: Client::new(), | 54 | client: Client::builder() |
| 55 | .connect_timeout(Duration::from_secs(10)) | ||
| 56 | .timeout(Duration::from_secs(60)) | ||
| 57 | .build() | ||
| 58 | .unwrap_or_default(), | ||
| 53 | } | 59 | } |
| 54 | } | 60 | } |
| 55 | 61 | ||
