Skip to content

Commit 0458e2c

Browse files
SiyuanQidavidzhao
andauthored
Bug fix: _play_speech get stuck due to orphan speech handle. (#1555)
Co-authored-by: David Zhao <dz@livekit.io>
1 parent 5896742 commit 0458e2c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/pink-kiwis-grab.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"livekit-agents": patch
3+
---
4+
5+
fix: _play_speech get stuck due to orphan speech handle

livekit-agents/livekit/agents/pipeline/pipeline_agent.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,9 @@ def _synthesize_agent_reply(self):
706706
self._agent_reply_task = asyncio.create_task(
707707
self._synthesize_answer_task(self._agent_reply_task, new_handle)
708708
)
709+
self._agent_reply_task.add_done_callback(
710+
lambda t: new_handle.cancel() if t.cancelled() else None
711+
)
709712

710713
@utils.log_exceptions(logger=logger)
711714
async def _synthesize_answer_task(

0 commit comments

Comments
 (0)