Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 198796d

Browse files
authored
Fix/inactive task error (#312)
* Fix task cancelled error being raised in inactive player tasks. * Remove unnecessary else statement
1 parent 52b863c commit 198796d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

wavelink/player.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,13 @@ def __init__(
169169
self._inactivity_wait: int | None = self._node._inactive_player_timeout
170170

171171
def _inactivity_task_callback(self, task: asyncio.Task[bool]) -> None:
172-
result: bool = task.result()
173-
cancelled: bool = task.cancelled()
172+
cancelled: bool = False
173+
174+
try:
175+
result: bool = task.result()
176+
except asyncio.CancelledError:
177+
cancelled = True
178+
result = False
174179

175180
if cancelled or result is False:
176181
logger.debug("Disregarding Inactivity Check Task <%s> as it was previously cancelled.", task.get_name())

0 commit comments

Comments
 (0)