1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-21 21:33:01 +00:00

Fix for ratelimiting possibly creating negative waits

This commit is contained in:
JKorf
2024-06-25 16:14:09 +02:00
parent ff0550b0fb
commit be68115099
6 changed files with 29 additions and 4 deletions
@@ -97,7 +97,10 @@ namespace CryptoExchange.Net.RateLimiting.Trackers
private TimeSpan DetermineWaitTime()
{
var checkTime = DateTime.UtcNow;
return (_nextReset!.Value - checkTime) + _fixedWindowBuffer;
var result = (_nextReset!.Value - checkTime) + _fixedWindowBuffer;
if (result < TimeSpan.Zero)
return TimeSpan.Zero;
return result;
}
}
}