From f47d439e33ade06e327f4fbd2a60fef2a330dd94 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Mon, 25 Jun 2018 07:37:40 +0000 Subject: [PATCH] Put all guilds in a list before going thru it --- discordbot/cleanup_db_messages.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/discordbot/cleanup_db_messages.py b/discordbot/cleanup_db_messages.py index d363af9..22bc4bd 100644 --- a/discordbot/cleanup_db_messages.py +++ b/discordbot/cleanup_db_messages.py @@ -91,8 +91,11 @@ class Titan(discord.AutoShardedClient): async def start_cleanup(self): with self.database.get_session() as session: guilds = session.query(Guilds).all() + guilds_new = [] count = 0 for guild in guilds: + guilds_new.append(guild) + for guild in guilds_new: count += 1 self.logger.info("[{}] snowflake-{} name-{}".format(count, guild.guild_id, guild.name)) try: