Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
5 changes: 5 additions & 0 deletions pydis_core/utils/scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

from pydis_core.utils import logging

_background_tasks: set[asyncio.Task] = set()


class Scheduler:
"""
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <info@pythondiscord.com>"]
license = "MIT"
Expand Down