From a0a7d397a7de1f5eb59223666bd067d21cdc2ca1 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Tue, 2 Jan 2024 03:34:14 -0500 Subject: [PATCH] feat(aurora): added more debug logging for the handle_expiry task --- aurora/aurora.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/aurora/aurora.py b/aurora/aurora.py index c384443..fdc86fa 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -946,6 +946,7 @@ class Aurora(commands.Cog): current_time = time.time() database = connect() cursor = database.cursor() + global_num = 0 guilds: list[discord.Guild] = self.bot.guilds for guild in guilds: @@ -963,6 +964,7 @@ class Aurora(commands.Cog): target_ids = [row[0] for row in result] moderation_ids = [row[1] for row in result] + num = 0 for target_id, moderation_id in zip(target_ids, moderation_ids): user: discord.User = await self.bot.fetch_user(target_id) try: @@ -974,6 +976,9 @@ class Aurora(commands.Cog): await user.send(embed=embed) except discord.errors.HTTPException: pass + + logger.debug("Unbanned %s#%s (%s) from %s (%s)", user.name, user.discriminator, user.id, guild.name, guild.id) + num = num + 1 except (discord.errors.NotFound, discord.errors.Forbidden, discord.errors.HTTPException) as e: logger.error("Failed to unban %s#%s (%s) from %s (%s)\n%s", user.name, user.discriminator, user.id, guild.name, guild.id, e) @@ -1001,14 +1006,15 @@ class Aurora(commands.Cog): continue per_guild_completion_time = (time.time() - time_per_guild) * 1000 - logger.debug("Completed expiry loop for %s (%s) in %sms", guild.name, guild.id, f"{per_guild_completion_time:.6f}") + logger.debug("Completed expiry loop for %s (%s) in %sms with %s users unbanned", guild.name, guild.id, f"{per_guild_completion_time:.6f}, num") + global_num = global_num + num database.commit() cursor.close() database.close() completion_time = (time.time() - current_time) * 1000 - logger.debug("Completed expiry loop in %sms", f"{completion_time:.6f}") + logger.debug("Completed expiry loop in %sms with %s users unbanned", f"{completion_time:.6f}", global_num) ####################################################################################################################### ### CONFIGURATION COMMANDS