Fix an issue where GoogleSTTService would timeout due to stream inactivity

This commit is contained in:
Mark Backman
2025-03-18 09:42:03 -04:00
parent 4677c34663
commit 5dc8b48fbe
2 changed files with 11 additions and 1 deletions

View File

@@ -1972,7 +1972,8 @@ class GoogleSTTService(STTService):
break
except Exception as e:
logger.error(f"Stream error, attempting to reconnect: {e}")
logger.warning(f"{self} Reconnecting: {e}")
await asyncio.sleep(1) # Brief delay before reconnecting
self._stream_start_time = int(time.time() * 1000)
continue
@@ -2025,3 +2026,6 @@ class GoogleSTTService(STTService):
except Exception as e:
logger.error(f"Error processing Google STT responses: {e}")
# Re-raise the exception to let it propagate (e.g. in the case of a timeout, propagate to _stream_audio to reconnect)
raise