diff options
author | 2022-12-23 19:23:40 +0100 | |
---|---|---|
committer | 2022-12-23 19:23:40 +0100 | |
commit | 4dc7593d92b1572d43947df0cba21cf4e1feb342 (patch) | |
tree | 83dd167a01c3a1023c64d98fc17382572ab2af14 | |
parent | Merge branch 'main' of https://github.com/shtlrs/bot-core (diff) |
save newly created tasks in a set
-rw-r--r-- | pydis_core/utils/scheduling.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pydis_core/utils/scheduling.py b/pydis_core/utils/scheduling.py index 8f9d711c..7987024c 100644 --- a/pydis_core/utils/scheduling.py +++ b/pydis_core/utils/scheduling.py @@ -10,7 +10,7 @@ from functools import partial from pydis_core.utils import logging -TASKS = set[asyncio.Task] +_background_tasks = set[asyncio.Task] class Scheduler: @@ -241,8 +241,8 @@ def create_task( else: task = asyncio.create_task(coro, **kwargs) - TASKS.add(task) - task.add_done_callback(TASKS.discard) + _background_tasks.add(task) + task.add_done_callback(_background_tasks.discard) task.add_done_callback(partial(_log_task_exception, suppressed_exceptions=suppressed_exceptions)) return task |