Skip to content
Closed
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
5 changes: 5 additions & 0 deletions .github/next-release/changeset-23d9c87a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-agents": patch
---

Fix: Properly retrieve exceptions after graceful task cancellation (#1991)
8 changes: 8 additions & 0 deletions livekit-agents/livekit/agents/utils/aio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ async def cancel_and_wait(*futures: asyncio.Future):
_, cb = waiters[i]
fut.remove_done_callback(cb)

# ✅ NEW: Safely retrieve exceptions to silence warnings
for fut in futures:
if fut.done():
try:
_ = fut.exception()
except Exception:
pass # Exception already retrieved or not present


def _release_waiter(waiter, *_):
if not waiter.done():
Expand Down
Loading