Skip to content

Commit

Permalink
Fix/inactive task error (#312)
Browse files Browse the repository at this point in the history
* Fix task cancelled error being raised in inactive player tasks.

* Remove unnecessary else statement
  • Loading branch information
EvieePy authored Jul 13, 2024
1 parent 52b863c commit 198796d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wavelink/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,13 @@ def __init__(
self._inactivity_wait: int | None = self._node._inactive_player_timeout

def _inactivity_task_callback(self, task: asyncio.Task[bool]) -> None:
result: bool = task.result()
cancelled: bool = task.cancelled()
cancelled: bool = False

try:
result: bool = task.result()
except asyncio.CancelledError:
cancelled = True
result = False

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

0 comments on commit 198796d

Please sign in to comment.