Skip to content

Commit

Permalink
refactor: rename and fix pop_temp_bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorukyum authored Jan 7, 2024
1 parent 6331678 commit fe0e6f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
9 changes: 5 additions & 4 deletions discord/rate_limiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -499,16 +499,17 @@ 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
----------
id: :class:`str`
This bucket's identifier.
"""

del self._temp_buckets[id]
if id in self._temp_buckets:
del self._temp_buckets[id]


class DynamicBucket:
Expand Down

0 comments on commit fe0e6f0

Please sign in to comment.