PipelineTask: fix repeated on_idle_timeout

This commit is contained in:
Aleix Conchillo Flaqué
2025-06-18 23:40:34 -07:00
parent ebb23a5a8c
commit 028f7b2d65
3 changed files with 49 additions and 3 deletions

View File

@@ -663,6 +663,11 @@ class PipelineTask(BaseTask):
diff_time = time.time() - last_frame_time
if diff_time >= self._idle_timeout_secs:
running = await self._idle_timeout_detected()
# Reset `last_frame_time` so we don't trigger another
# immediate idle timeout if we are not cancelling. For
# example, we might want to force the bot to say goodbye
# and then clean nicely with an `EndFrame`.
last_frame_time = time.time()
self._idle_queue.task_done()
except asyncio.TimeoutError: