File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
homeassistant/components/google_cloud Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 66import logging
77
88from google .api_core .exceptions import GoogleAPIError , Unauthenticated
9+ from google .api_core .retry import AsyncRetry
910from google .cloud import speech_v1
1011
1112from homeassistant .components .stt import (
@@ -127,6 +128,7 @@ async def request_generator() -> AsyncGenerator[
127128 responses = await self ._client .streaming_recognize (
128129 requests = request_generator (),
129130 timeout = 10 ,
131+ retry = AsyncRetry (initial = 0.1 , maximum = 2.0 , multiplier = 2.0 ),
130132 )
131133
132134 transcript = ""
Original file line number Diff line number Diff line change 77from typing import Any , cast
88
99from google .api_core .exceptions import GoogleAPIError , Unauthenticated
10+ from google .api_core .retry import AsyncRetry
1011from google .cloud import texttospeech
1112import voluptuous as vol
1213
@@ -215,7 +216,11 @@ async def _async_get_tts_audio(
215216 ),
216217 )
217218
218- response = await self ._client .synthesize_speech (request , timeout = 10 )
219+ response = await self ._client .synthesize_speech (
220+ request ,
221+ timeout = 10 ,
222+ retry = AsyncRetry (initial = 0.1 , maximum = 2.0 , multiplier = 2.0 ),
223+ )
219224
220225 if encoding == texttospeech .AudioEncoding .MP3 :
221226 extension = "mp3"
You can’t perform that action at this time.
0 commit comments