diff options
| author | 2020-02-24 16:53:22 -0800 | |
|---|---|---|
| committer | 2020-03-22 15:54:36 -0700 | |
| commit | f3b54c2f35d2ab11e6ac88c94b1729fb2b86b781 (patch) | |
| tree | 2c21b9f7e77ac63999c610861387bb6ae483f2d3 | |
| parent | HelpChannels: implement the on_message listener (diff) | |
HelpChannels: cancel scheduled tasks when the cog unloads
* Make cog_unload a regular method instead of a coroutine
| -rw-r--r-- | bot/cogs/help_channels.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py index 6b77f9955..f493e5918 100644 --- a/bot/cogs/help_channels.py +++ b/bot/cogs/help_channels.py @@ -74,10 +74,13 @@ class HelpChannels(Scheduler, commands.Cog): self.ready = asyncio.Event() self.init_task = asyncio.create_task(self.init_cog()) - async def cog_unload(self) -> None: - """Cancel the init task if the cog unloads.""" + def cog_unload(self) -> None: + """Cancel the init task and scheduled tasks when the cog unloads.""" self.init_task.cancel() + for task in self.scheduled_tasks.values(): + task.cancel() + def create_channel_queue(self) -> asyncio.Queue: """ Return a queue of dormant channels to use for getting the next available channel. |