Skip to content
Open
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
19 changes: 17 additions & 2 deletions src/pipecat/transports/daily/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@

VAD_RESET_PERIOD_MS = 2000

# Timeout constants for Daily operations
DAILY_JOIN_TIMEOUT_SECS = 30.0
DAILY_LEAVE_TIMEOUT_SECS = 30.0


@dataclass
class DailyOutputTransportMessageFrame(OutputTransportMessageFrame):
Expand Down Expand Up @@ -828,7 +832,12 @@ async def _join(self):
},
)

return await future
try:
return await asyncio.wait_for(future, timeout=DAILY_JOIN_TIMEOUT_SECS)
except asyncio.TimeoutError:
error_msg = f"Timeout joining {self._room_url} after {DAILY_JOIN_TIMEOUT_SECS}s"
logger.error(error_msg)
return (None, error_msg)

async def leave(self):
"""Leave the Daily room and cleanup resources."""
Expand Down Expand Up @@ -867,7 +876,13 @@ async def _leave(self):

future = self._get_event_loop().create_future()
self._client.leave(completion=completion_callback(future))
return await future

try:
return await asyncio.wait_for(future, timeout=DAILY_LEAVE_TIMEOUT_SECS)
except asyncio.TimeoutError:
error_msg = f"Timeout leaving {self._room_url} after {DAILY_LEAVE_TIMEOUT_SECS}s"
logger.error(error_msg)
return error_msg

def _cleanup(self):
"""Cleanup the Daily client instance."""
Expand Down