Fixed gc not being reusable in buckets.
@@ -382,7 +382,7 @@ class RESTBucketManager:
as the rate limit has reset. Defaults to `10` seconds.
"""
if not self.gc_task:
- self.gc_task = asyncio.get_running_loop().create_task(self.gc(poll_period, expire_after))
+ self.gc_task = asyncio.create_task(self.gc(poll_period, expire_after))
def close(self) -> None:
"""Close the garbage collector and kill any tasks waiting on ratelimits.
@@ -398,6 +398,7 @@ class RESTBucketManager:
if self.gc_task is not None:
self.gc_task.cancel()
+ self.gc_task = None
# Ignore docstring not starting in an imperative mood
async def gc(self, poll_period: float, expire_after: float) -> None: # noqa: D401
