From 164c38fb0f53580f7c7a55e9cf7d4ce2b2b93787 Mon Sep 17 00:00:00 2001 From: cxfksword <718792+cxfksword@users.noreply.github.com> Date: Sat, 10 May 2025 11:04:02 +0800 Subject: [PATCH] perf: dandan api speed limit --- Jellyfin.Plugin.Danmu/Scrapers/Dandan/DandanApi.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jellyfin.Plugin.Danmu/Scrapers/Dandan/DandanApi.cs b/Jellyfin.Plugin.Danmu/Scrapers/Dandan/DandanApi.cs index 4c105d6..245fc64 100644 --- a/Jellyfin.Plugin.Danmu/Scrapers/Dandan/DandanApi.cs +++ b/Jellyfin.Plugin.Danmu/Scrapers/Dandan/DandanApi.cs @@ -80,7 +80,7 @@ public class DandanApi : AbstractApi } var cacheKey = $"search_{keyword}"; - var expiredOption = new MemoryCacheEntryOptions() { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5) }; + var expiredOption = new MemoryCacheEntryOptions() { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(30) }; if (_memoryCache.TryGetValue>(cacheKey, out var searchResult)) { return searchResult; @@ -219,6 +219,8 @@ public class DandanApi : AbstractApi throw new ArgumentNullException(nameof(epId)); } + this.LimitRequestFrequently(); + var withRelated = this.Config.WithRelatedDanmu ? "true" : "false"; var chConvert = this.Config.ChConvert; var url = $"https://api.dandanplay.net/api/v2/comment/{epId}?withRelated={withRelated}&chConvert={chConvert}";