Dont enter the ratelimit semaphore twice

This commit is contained in:
RogueException
2016-07-24 18:45:24 -03:00
parent 8a27ac1718
commit 7e08b4e50a

View File

@@ -42,7 +42,7 @@ namespace Discord.Net.Queue
}
catch (HttpRateLimitException ex)
{
//When a 429 occurs, we drop all our locks, including the ones we wanted.
//When a 429 occurs, we drop all our locks.
//This is generally safe though since 429s actually occuring should be very rare.
RequestQueueBucket bucket;
bool success = FindBucket(ex.BucketId, out bucket);
@@ -152,7 +152,8 @@ namespace Discord.Net.Queue
if (millis <= 0 || !await _semaphore.WaitAsync(millis).ConfigureAwait(false))
throw new TimeoutException();
}
await _semaphore.WaitAsync().ConfigureAwait(false);
else
await _semaphore.WaitAsync().ConfigureAwait(false);
}
private async Task QueueExitAsync()
{