From 1555f8da0c1053ce48c9c9683457b7869928c668 Mon Sep 17 00:00:00 2001 From: Jonnern <10881387+Jonnern@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:47:14 +0200 Subject: [PATCH] Fix issue with rate limit guard waiting sub ms (#204) --- CryptoExchange.Net/RateLimiting/RateLimitGate.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CryptoExchange.Net/RateLimiting/RateLimitGate.cs b/CryptoExchange.Net/RateLimiting/RateLimitGate.cs index b55c2e3..900523d 100644 --- a/CryptoExchange.Net/RateLimiting/RateLimitGate.cs +++ b/CryptoExchange.Net/RateLimiting/RateLimitGate.cs @@ -101,7 +101,7 @@ namespace CryptoExchange.Net.RateLimiting logger.RateLimitDelayingRequest(itemId, definition.Path, result.Delay, guard.Name, description); RateLimitTriggered?.Invoke(new RateLimitEvent(_name, guard.Description, definition, host, result.Current, requestWeight, result.Limit, result.Period, result.Delay, rateLimitingBehaviour)); - await Task.Delay(result.Delay, ct).ConfigureAwait(false); + await Task.Delay((int)result.Delay.TotalMilliseconds + 1, ct).ConfigureAwait(false); await _semaphore.WaitAsync(ct).ConfigureAwait(false); return await CheckGuardsAsync(guards, logger, itemId, type, definition, host, apiKey, requestWeight, rateLimitingBehaviour, ct).ConfigureAwait(false); }