1
0
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:
Jkorf 2026-04-10 10:01:13 +02:00
parent 9add5e0adc
commit 4d4b0576ee
2 changed files with 7 additions and 1 deletions

View File

@ -175,6 +175,12 @@ namespace CryptoExchange.Net.RateLimiting.Guards
/// <inheritdoc />
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)
_sharedGuardSemaphore!.Wait();

View File

@ -298,7 +298,7 @@ namespace CryptoExchange.Net.Sockets.Default
}
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
var initialDelay = GetReconnectDelay();