mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-02 00:00:02 +00:00
Fix potentially stuck ratelimit buckets
This commit is contained in:
parent
ef06d7d9db
commit
b28a4a115e
@ -461,7 +461,12 @@ class Ratelimit:
|
|||||||
future = self._loop.create_future()
|
future = self._loop.create_future()
|
||||||
self._pending_requests.append(future)
|
self._pending_requests.append(future)
|
||||||
try:
|
try:
|
||||||
await future
|
while not future.done():
|
||||||
|
# 30 matches the smallest allowed max_ratelimit_timeout
|
||||||
|
max_wait_time = self.expires - self._loop.time() if self.expires else 30
|
||||||
|
await asyncio.wait([future], timeout=max_wait_time)
|
||||||
|
if not future.done():
|
||||||
|
await self._refresh()
|
||||||
except:
|
except:
|
||||||
future.cancel()
|
future.cancel()
|
||||||
if self.remaining > 0 and not future.cancelled():
|
if self.remaining > 0 and not future.cancelled():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user