From 953114041bb8381314c7f880d83c5157d0b6b3ad Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Tue, 1 Oct 2024 12:02:29 +0800 Subject: [PATCH] add connect timeout --- src-tauri/src/stream.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src-tauri/src/stream.rs b/src-tauri/src/stream.rs index 3d21623e6f3..d2c0726b0b4 100644 --- a/src-tauri/src/stream.rs +++ b/src-tauri/src/stream.rs @@ -1,6 +1,7 @@ // // +use std::time::Duration; use std::error::Error; use std::sync::atomic::{AtomicU32, Ordering}; use std::collections::HashMap; @@ -56,6 +57,7 @@ pub async fn stream_fetch( let client = Client::builder() .default_headers(_headers) .redirect(reqwest::redirect::Policy::limited(3)) + .connect_timeout(Duration::new(3, 0)) .build() .map_err(|err| format!("failed to generate client: {}", err))?;