aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2020-08-04 19:44:17 +0200
committerGravatar kwzrd <[email protected]>2020-08-04 19:48:22 +0200
commit18f2f1b8817f0209922112a0576b9b0377c2958d (patch)
tree1a4fbe5614efca5c712b0ec14188333b05d3af2f
parentVerification: add region comments & move property to top (diff)
Verification: schedule member update task
Turns out that it's necessary to cancel the task manually. Otherwise, duplicate tasks can be running concurrently should the extension be reloaded.
-rw-r--r--bot/cogs/verification.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/bot/cogs/verification.py b/bot/cogs/verification.py
index 951736761..0534e8d1e 100644
--- a/bot/cogs/verification.py
+++ b/bot/cogs/verification.py
@@ -57,9 +57,20 @@ BOT_MESSAGE_DELETE_DELAY = 10
class Verification(Cog):
"""User verification and role self-management."""
- def __init__(self, bot: Bot):
+ def __init__(self, bot: Bot) -> None:
+ """Start `update_unverified_members` task."""
self.bot = bot
+ self.update_unverified_members.start()
+
+ def cog_unload(self) -> None:
+ """
+ Kill `update_unverified_members` task.
+
+ This is necessary, the task is not automatically cancelled on cog unload.
+ """
+ self.update_unverified_members.cancel()
+
@property
def mod_log(self) -> ModLog:
"""Get currently loaded ModLog cog instance."""