mirror of
				https://github.com/TitanEmbeds/Titan.git
				synced 2025-11-03 23:37:09 +01:00 
			
		
		
		
	Run until complete on the cleanup function
This commit is contained in:
		@@ -52,7 +52,7 @@ class TitanCleanupDB:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def run(self):
 | 
					    def run(self):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            self.loop.run_until_complete(self.on_ready())
 | 
					            self.loop.run_until_complete(self.start_cleanup())
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            print("Error!", e)
 | 
					            print("Error!", e)
 | 
				
			||||||
        finally:
 | 
					        finally:
 | 
				
			||||||
@@ -62,7 +62,7 @@ class TitanCleanupDB:
 | 
				
			|||||||
                print("Error in cleanup:", e)
 | 
					                print("Error in cleanup:", e)
 | 
				
			||||||
            self.loop.close()
 | 
					            self.loop.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async def on_ready(self):
 | 
					    async def start_cleanup(self):
 | 
				
			||||||
        print('Titan [DiscordBot] [UTILITY: Cleanup database messages]')
 | 
					        print('Titan [DiscordBot] [UTILITY: Cleanup database messages]')
 | 
				
			||||||
        print('------')
 | 
					        print('------')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -74,9 +74,6 @@ class TitanCleanupDB:
 | 
				
			|||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        print("working on this...")
 | 
					        print("working on this...")
 | 
				
			||||||
        self.loop.create_task(self.start_cleanup())
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    async def start_cleanup(self):
 | 
					 | 
				
			||||||
        with self.database.get_session() as session:
 | 
					        with self.database.get_session() as session:
 | 
				
			||||||
            guilds = session.query(Guilds).all()
 | 
					            guilds = session.query(Guilds).all()
 | 
				
			||||||
            guilds_new = []
 | 
					            guilds_new = []
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user