diff options
| -rw-r--r-- | docs/changelog.rst | 4 | ||||
| -rw-r--r-- | pydis_core/utils/scheduling.py | 5 | ||||
| -rw-r--r-- | pyproject.toml | 2 | 
3 files changed, 10 insertions, 1 deletions
| diff --git a/docs/changelog.rst b/docs/changelog.rst index ee4cc69c..0734158a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,10 @@  Changelog  ========= + +- :release:`9.3.1 <23rd December 2022>` +- :bug:`170` Save references of newly created tasks in :obj:`pydis_core.utils.scheduling` +  - :release:`9.3.0 <13th December 2022>`  - :feature:`169` Return :obj:`None` upon receiving a bad request from Discord in :obj:`pydis_core.utils.members.get_or_fetch_member` diff --git a/pydis_core/utils/scheduling.py b/pydis_core/utils/scheduling.py index eced4a3d..d4458bc1 100644 --- a/pydis_core/utils/scheduling.py +++ b/pydis_core/utils/scheduling.py @@ -10,6 +10,8 @@ from functools import partial  from pydis_core.utils import logging +_background_tasks: set[asyncio.Task] = set() +  class Scheduler:      """ @@ -238,6 +240,9 @@ def create_task(          task = event_loop.create_task(coro, **kwargs)      else:          task = asyncio.create_task(coro, **kwargs) + +    _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 diff --git a/pyproject.toml b/pyproject.toml index 482dfdca..cac29809 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@  [tool.poetry]  name = "pydis_core" -version = "9.3.0" +version = "9.3.1"  description = "PyDis core provides core functionality and utility to the bots of the Python Discord community."  authors = ["Python Discord <[email protected]>"]  license = "MIT" | 
