Custom Request Limits #109

This commit is contained in:
2024-01-31 18:30:44 +01:00
parent e49db9a4cb
commit 31a4e693e0
4 changed files with 37 additions and 9 deletions

View File

@ -15,6 +15,14 @@ internal abstract class DownloadClient : GlobalBase
foreach (KeyValuePair<byte, int> limit in rateLimitRequestsPerMinute)
_rateLimit.Add(limit.Key, TimeSpan.FromMinutes(1).Divide(limit.Value));
}
internal void SetCustomRequestLimit(byte requestType, int limit)
{
if (_rateLimit.ContainsKey(requestType))
_rateLimit[requestType] = TimeSpan.FromMinutes(1).Divide(limit);
else
_rateLimit.Add(requestType, TimeSpan.FromMinutes(1).Divide(limit));
}
public RequestResult MakeRequest(string url, byte requestType, string? referrer = null, string? clickButton = null)
{