mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2026-04-12 16:13:12 +00:00
Fix for rate limiter resetting
This commit is contained in:
parent
9add5e0adc
commit
4d4b0576ee
@ -175,6 +175,12 @@ namespace CryptoExchange.Net.RateLimiting.Guards
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Reset(RateLimitItemType type, RequestDefinition definition, string host, string? apiKey, string? keySuffix)
|
public void Reset(RateLimitItemType type, RequestDefinition definition, string host, string? apiKey, string? keySuffix)
|
||||||
{
|
{
|
||||||
|
foreach (var filter in _filters)
|
||||||
|
{
|
||||||
|
if (!filter.Passes(type, definition, host, apiKey))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (SharedGuard)
|
if (SharedGuard)
|
||||||
_sharedGuardSemaphore!.Wait();
|
_sharedGuardSemaphore!.Wait();
|
||||||
|
|
||||||
|
|||||||
@ -298,7 +298,7 @@ namespace CryptoExchange.Net.Sockets.Default
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Parameters.RateLimiter != null)
|
if (Parameters.RateLimiter != null)
|
||||||
await Parameters.RateLimiter.ResetAsync(RateLimitItemType.Connection, _requestDefinition, _baseAddress, null, null, _ctsSource.Token).ConfigureAwait(false);
|
await Parameters.RateLimiter.ResetAsync(RateLimitItemType.Request, _requestDefinition, _baseAddress, null, null, default).ConfigureAwait(false);
|
||||||
|
|
||||||
// Delay here to prevent very rapid looping when a connection to the server is accepted and immediately disconnected
|
// Delay here to prevent very rapid looping when a connection to the server is accepted and immediately disconnected
|
||||||
var initialDelay = GetReconnectDelay();
|
var initialDelay = GetReconnectDelay();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user