Explorar el Código

add connect timeout

lloydzhou hace 1 año
padre
commit
953114041b
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      src-tauri/src/stream.rs

+ 2 - 0
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))?;