From de1fd67b2dc9b07c2a13d29bc6da16102dff5172 Mon Sep 17 00:00:00 2001 From: filipi87 Date: Fri, 27 Mar 2026 18:18:28 -0300 Subject: [PATCH] Adding fallback in case the clock queue is not drained. --- src/pipecat/transports/base_output.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pipecat/transports/base_output.py b/src/pipecat/transports/base_output.py index 22d7d44e8..dba2f4412 100644 --- a/src/pipecat/transports/base_output.py +++ b/src/pipecat/transports/base_output.py @@ -834,7 +834,13 @@ class BaseOutputTransport(FrameProcessor): if isinstance(frame, TTSStoppedFrame) and self._clock_flush_event is not None: logger.debug(f"{self._transport} audio queue signalling clock queue flush") self._clock_flush_event.set() - await self._clock_drained_event.wait() + try: + await asyncio.wait_for(self._clock_drained_event.wait(), timeout=BOT_VAD_STOP_FALLBACK_SECS) + except asyncio.TimeoutError: + logger.warning( + f"{self._transport} timed out waiting for clock queue to drain, " + "pushing TTSStoppedFrame downstream anyway" + ) self._clock_flush_event = None self._clock_drained_event = None