forked from blizzthewolf/SeaCogs
feat(aurora): added more debug logging for the handle_expiry task
This commit is contained in:
parent
50c5785245
commit
a0a7d397a7
1 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue