mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-10-21 02:20:56 +00:00
Added RateLimitAdmission client option delegate
This commit is contained in:
@@ -53,7 +53,7 @@ namespace CryptoExchange.Net.RateLimiting.Guards
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public LimitCheck Check(RateLimitItemType type, RequestDefinition definition, string? apiKey, int requestWeight, string? keySuffix)
|
||||
public LimitCheck Check(RateLimitItemType type, RequestDefinition definition, string? apiKey, int requestWeight, string? keySuffix, double allowedRateRatio)
|
||||
{
|
||||
var key = _keySelector(definition, apiKey) + keySuffix;
|
||||
if (!_trackers.TryGetValue(key, out var tracker))
|
||||
@@ -62,7 +62,7 @@ namespace CryptoExchange.Net.RateLimiting.Guards
|
||||
_trackers.Add(key, tracker);
|
||||
}
|
||||
|
||||
var delay = tracker.GetWaitTime(requestWeight);
|
||||
var delay = tracker.GetWaitTime(requestWeight, allowedRateRatio);
|
||||
if (delay == default)
|
||||
return LimitCheck.NotNeeded(_limit, _period, tracker.Current);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user