From f6ba99dd5e79eabbd907c2ee16f18c542c1c803d Mon Sep 17 00:00:00 2001 From: amtoaer Date: Fri, 3 May 2024 12:44:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=E5=87=8F=E5=B0=91=E5=B9=B6?= =?UTF-8?q?=E5=8F=91=E4=B8=8B=E8=BD=BD=E9=87=8F=E4=B8=8E=20read=5Ftimeout?= =?UTF-8?q?=20=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bilibili/client.rs | 2 +- src/core/command.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bilibili/client.rs b/src/bilibili/client.rs index b62355d..206d3eb 100644 --- a/src/bilibili/client.rs +++ b/src/bilibili/client.rs @@ -29,7 +29,7 @@ impl Client { .default_headers(headers) .gzip(true) .connect_timeout(std::time::Duration::from_secs(10)) - .read_timeout(std::time::Duration::from_secs(30)) + .read_timeout(std::time::Duration::from_secs(10)) .build() .unwrap(), ) diff --git a/src/core/command.rs b/src/core/command.rs index 0e9d379..1515761 100644 --- a/src/core/command.rs +++ b/src/core/command.rs @@ -157,8 +157,8 @@ pub async fn download_unprocessed_videos( favorite_model.f_id, favorite_model.name ); let unhandled_videos_pages = unhandled_videos_pages(&favorite_model, connection).await?; - // 对于视频,允许五个同时下载(视频内还有分页、不同分页还有多种下载任务) - let semaphore = Semaphore::new(5); + // 对于视频,允许三个同时下载(视频内还有分页、不同分页还有多种下载任务) + let semaphore = Semaphore::new(3); let downloader = Downloader::new(bili_client.client.clone()); let mut uppers_mutex: HashMap, Mutex<()>)> = HashMap::new(); for (video_model, _) in &unhandled_videos_pages { @@ -312,8 +312,8 @@ pub async fn dispatch_download_page( if !should_run { return Ok(()); } - // 对于视频的分页,允许同时下载三个同时下载(绝大部分是单页视频) - let child_semaphore = Semaphore::new(5); + // 对于视频的分页,允许同时下载两个同时下载(绝大部分是单页视频) + let child_semaphore = Semaphore::new(2); let mut tasks = pages .into_iter() .map(|page_model| download_page(bili_client, video_model, page_model, &child_semaphore, downloader)) From 2313d034f87d9941b2a865e2845d747d35f69097 Mon Sep 17 00:00:00 2001 From: amtoaer Date: Fri, 3 May 2024 12:45:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E4=BF=AE=E6=AD=A3=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/command.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/command.rs b/src/core/command.rs index 1515761..428e68c 100644 --- a/src/core/command.rs +++ b/src/core/command.rs @@ -312,7 +312,7 @@ pub async fn dispatch_download_page( if !should_run { return Ok(()); } - // 对于视频的分页,允许同时下载两个同时下载(绝大部分是单页视频) + // 对于视频的分页,允许两个同时下载(绝大部分是单页视频) let child_semaphore = Semaphore::new(2); let mut tasks = pages .into_iter()