diff options
-rw-r--r-- | bot/exts/moderation/metabase.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bot/exts/moderation/metabase.py b/bot/exts/moderation/metabase.py index e1531c467..db5f04d83 100644 --- a/bot/exts/moderation/metabase.py +++ b/bot/exts/moderation/metabase.py @@ -159,11 +159,14 @@ class Metabase(Cog): return all(checks) def cog_unload(self) -> None: - """Cancel the init task and scheduled tasks.""" - # It's important to wait for init_task to be cancelled before cancelling scheduled - # tasks. Otherwise, it's possible for _session_scheduler to schedule another task - # after cancel_all has finished, despite _init_task.cancel being called first. - # This is cause cancel() on its own doesn't block until the task is cancelled. + """ + Cancel the init task and scheduled tasks. + + It's important to wait for init_task to be cancelled before cancelling scheduled + tasks. Otherwise, it's possible for _session_scheduler to schedule another task + after cancel_all has finished, despite _init_task.cancel being called first. + This is cause cancel() on its own doesn't block until the task is cancelled. + """ self.init_task.cancel() self.init_task.add_done_callback(lambda _: self._session_scheduler.cancel_all()) |