From 918c11fcba1a47f78ce17eb7278da294d95e314c Mon Sep 17 00:00:00 2001 From: ks123 Date: Wed, 4 Mar 2020 13:36:16 +0200 Subject: (Games Cog): Stop refreshing genres task when Cog unload --- bot/seasons/evergreen/game.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bot') diff --git a/bot/seasons/evergreen/game.py b/bot/seasons/evergreen/game.py index 21c3b5d7..97df2bdb 100644 --- a/bot/seasons/evergreen/game.py +++ b/bot/seasons/evergreen/game.py @@ -157,6 +157,11 @@ class Games(Cog): return logger.info("Successfully refreshed genres.") + def cog_unload(self) -> None: + """Cancel genres refreshing start when unloading Cog.""" + self.refresh_genres_task.cancel() + logger.info("Successfully stopped Genres Refreshing task.") + async def _get_genres(self) -> None: """Create genres variable for games command.""" body = "fields name; limit 100;" -- cgit v1.2.3