From e48c0e52ef4bdea0b5e761bee3b697670462b24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Fri, 24 Jan 2025 19:29:35 -0800 Subject: [PATCH] transports(daily): avoid canceling task more than once --- src/pipecat/transports/services/daily.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pipecat/transports/services/daily.py b/src/pipecat/transports/services/daily.py index bccc54316..70df2f05a 100644 --- a/src/pipecat/transports/services/daily.py +++ b/src/pipecat/transports/services/daily.py @@ -476,7 +476,9 @@ class DailyTransportClient(EventHandler): return await asyncio.wait_for(future, timeout=10) async def cleanup(self): - await cancel_task(self._callback_task) + if self._callback_task: + await cancel_task(self._callback_task) + self._callback_task = None # Make sure we don't block the event loop in case `client.release()` # takes extra time. await self._loop.run_in_executor(self._executor, self._cleanup)