aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bot/cogs/moderation/scheduler.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bot/cogs/moderation/scheduler.py b/bot/cogs/moderation/scheduler.py
index 162159af8..93afd9f9f 100644
--- a/bot/cogs/moderation/scheduler.py
+++ b/bot/cogs/moderation/scheduler.py
@@ -1,3 +1,4 @@
+import asyncio
import logging
import textwrap
import typing as t
@@ -427,6 +428,6 @@ class InfractionScheduler(Scheduler):
expiry = dateutil.parser.isoparse(infraction["expires_at"]).replace(tzinfo=None)
await time.wait_until(expiry)
- # Because deactivate_infraction() explicitly cancels this scheduled task, it runs in
- # a separate task to avoid prematurely cancelling itself.
- self.bot.loop.create_task(self.deactivate_infraction(infraction))
+ # Because deactivate_infraction() explicitly cancels this scheduled task, it is shielded
+ # to avoid prematurely cancelling itself.
+ await asyncio.shield(self.deactivate_infraction(infraction))