From 7dc049ffe58de8633be1242f371e5d348e53770b Mon Sep 17 00:00:00 2001 From: amtoaer Date: Tue, 14 Jan 2025 00:08:38 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E9=BB=98=E8=AE=A4=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E9=A2=91=E7=8E=87=E9=99=90=E5=88=B6=EF=BC=8C?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=AF=E6=89=8B=E5=8A=A8=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/bili_sync/src/bilibili/client.rs | 2 +- crates/bili_sync/src/config/item.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/bili_sync/src/bilibili/client.rs b/crates/bili_sync/src/bilibili/client.rs index 4810646..70b71d6 100644 --- a/crates/bili_sync/src/bilibili/client.rs +++ b/crates/bili_sync/src/bilibili/client.rs @@ -78,7 +78,7 @@ impl BiliClient { .initial(*limit) .refill(*limit) .max(*limit) - .interval(Duration::from_secs(*duration)) + .interval(Duration::from_millis(*duration)) .build() }); Self { client, limiter } diff --git a/crates/bili_sync/src/config/item.rs b/crates/bili_sync/src/config/item.rs index 0ce5997..abc85f3 100644 --- a/crates/bili_sync/src/config/item.rs +++ b/crates/bili_sync/src/config/item.rs @@ -44,7 +44,11 @@ impl Default for ConcurrentLimit { Self { video: 3, page: 2, - rate_limit: None, + // 默认的限速配置,每 250ms 允许请求 4 次 + rate_limit: Some(RateLimit { + limit: 4, + duration: 250, + }), } } }