Use DelegatingHandler for RateLimits
Some checks failed
Docker Image CI / build (push) Has been cancelled

This commit is contained in:
2025-10-06 22:48:46 +02:00
parent 02cec53963
commit ed07bba841
15 changed files with 142 additions and 538 deletions

View File

@@ -1,5 +1,4 @@
using System.Runtime.InteropServices;
using API.MangaDownloadClients;
using API.Workers;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@@ -38,17 +37,6 @@ public struct TrangaSettings()
/// </summary>
public string ChapterNamingScheme { get; set; } = "%M - ?V(Vol.%V )Ch.%C?T( - %T)";
public int WorkCycleTimeoutMs { get; set; } = 20000;
[JsonIgnore]
internal static readonly Dictionary<RequestType, int> DefaultRequestLimits = new ()
{
{RequestType.MangaInfo, 360},
{RequestType.MangaDexFeed, 360},
{RequestType.MangaDexImage, 60},
{RequestType.MangaImage, 240},
{RequestType.MangaCover, 60},
{RequestType.Default, 360}
};
public Dictionary<RequestType, int> RequestLimits { get; set; } = DefaultRequestLimits;
public string DownloadLanguage { get; set; } = "en";
@@ -78,18 +66,6 @@ public struct TrangaSettings()
Save();
}
public void SetRequestLimit(RequestType type, int value)
{
this.RequestLimits[type] = value;
Save();
}
public void ResetRequestLimits()
{
this.RequestLimits = DefaultRequestLimits;
Save();
}
public void UpdateImageCompression(int value)
{
this.ImageCompression = value;