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/commands | |
| 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 'src/commands')
| -rw-r--r-- | src/commands/web.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/commands/web.rs b/src/commands/web.rs index d68f663..f8b8667 100644 --- a/src/commands/web.rs +++ b/src/commands/web.rs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | use std::time::Duration; | ||
| 2 | |||
| 1 | use poise::serenity_prelude as serenity; | 3 | use poise::serenity_prelude as serenity; |
| 2 | use scraper::{Html, Selector}; | 4 | use scraper::{Html, Selector}; |
| 3 | 5 | ||
| @@ -20,6 +22,7 @@ pub async fn web(ctx: Context<'_>, #[description = "Search query"] query: String | |||
| 20 | .data() | 22 | .data() |
| 21 | .http_client | 23 | .http_client |
| 22 | .get(&url) | 24 | .get(&url) |
| 25 | .timeout(Duration::from_secs(15)) | ||
| 23 | .send() | 26 | .send() |
| 24 | .await? | 27 | .await? |
| 25 | .text() | 28 | .text() |
