From 513c56512797e97fa830905ef0f8b5ff3de8ffbd Mon Sep 17 00:00:00 2001 From: imp <106537315+imptype@users.noreply.github.com> Date: Wed, 3 Sep 2025 14:47:18 +0100 Subject: [PATCH] Reorder future to fix typehint Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com> --- discord/http.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/discord/http.py b/discord/http.py index 1139a3ec5..b6c754714 100644 --- a/discord/http.py +++ b/discord/http.py @@ -453,13 +453,13 @@ class Ratelimit: # If reset_at is not set yet, wait for the last request, if outgoing, to finish first # for up to 3 seconds instead of using aiohttp's default 5 min timeout. if self.reset_at == 0.0 and (self._last_request == 0.0 or self.http.loop.time() - self._last_request < 3): + self._future = future = self.http.loop.create_future() try: - self._future = self.http.loop.create_future() - await asyncio.wait_for(self._future, 3) + await asyncio.wait_for(future, 3) except asyncio.TimeoutError: fmt = 'Initial request for rate limit bucket (%s) never finished. Skipping.' _log.warning(fmt, self.key) - self._future.cancel() # type: ignore + future.cancel() # If none are still remaining then start sleeping if self.remaining == 0 and not self.one_shot: