aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/utils/scheduling.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/bot/utils/scheduling.py b/bot/utils/scheduling.py
index 9fc519393..fddb0c2fe 100644
--- a/bot/utils/scheduling.py
+++ b/bot/utils/scheduling.py
@@ -43,6 +43,9 @@ class Scheduler:
"""
self._log.trace(f"Scheduling task #{task_id}...")
+ msg = f"Cannot schedule an already started coroutine for #{task_id}"
+ assert inspect.getcoroutinestate(coroutine) == "CORO_CREATED", msg
+
if task_id in self._scheduled_tasks:
self._log.debug(f"Did not schedule task #{task_id}; task was already scheduled.")
coroutine.close()