diff --git a/discord/http.py b/discord/http.py index 89e8171a87..cebd350024 100644 --- a/discord/http.py +++ b/discord/http.py @@ -337,7 +337,7 @@ async def request( await tbucket.use( retry_after, remaining or 10, is_global=True ) - await self._rate_limit.pop_temp_bucket(bucket_id) + await self._rate_limit.delete_temp_bucket(bucket_id) _log.debug( "Done sleeping for the rate limit. Retrying..." diff --git a/discord/rate_limiting.py b/discord/rate_limiting.py index f428ca947a..38ca3a14f6 100644 --- a/discord/rate_limiting.py +++ b/discord/rate_limiting.py @@ -387,7 +387,7 @@ async def push_temp_bucket(self, id: str, bucket: DynamicBucket) -> None: This bucket's identifier. """ - async def pop_temp_bucket(self, id: str) -> None: + async def delete_temp_bucket(self, id: str) -> None: """Pop a temporary bucket which *may* be in storage. Parameters @@ -499,8 +499,8 @@ async def push_temp_bucket(self, id: str, bucket: DynamicBucket) -> None: self._temp_buckets[id] = bucket - async def pop_temp_bucket(self, id: str) -> None: - """Pop a temporary bucket which *may* be in storage. + async def delete_temp_bucket(self, id: str) -> None: + """Delete a temporary bucket which may be in storage. Parameters ---------- @@ -508,7 +508,8 @@ async def pop_temp_bucket(self, id: str) -> None: This bucket's identifier. """ - del self._temp_buckets[id] + if id in self._temp_buckets: + del self._temp_buckets[id] class DynamicBucket: