Skip to content

Commit

Permalink
Removing Garbage Collection
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanStoves committed May 15, 2024
1 parent 55c7a7e commit dc8d3fc
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions dbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ def __init__(self, prefix, description=None, **options):
self.glclient = GameLogClient(self)
self.glclient.init()

# lock for garbage collection
self.gc_lock = asyncio.Lock()

async def setup_rdb(self):
return RedisIO(await redis.from_url(url=config.REDIS_URL))

Expand Down Expand Up @@ -275,18 +272,6 @@ async def on_ready():
log.info(bot.user.id)
log.info("------")


@bot.event
async def on_resumed():
if bot.gc_lock.locked():
return

async with bot.gc_lock:
await asyncio.sleep(2.0) # Wait for 2 seconds
collected = gc.collect() # Perform garbage collection
log.info(f"Garbage collector: collected {collected} objects.")


@bot.listen("on_command_error")
@bot.listen("on_slash_command_error")
async def command_errors(ctx, error):
Expand Down

0 comments on commit dc8d3fc

Please sign in to comment.