File tree 1 file changed +10
-11
lines changed
livekit-plugins/livekit-plugins-google/livekit/plugins/google
1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -304,21 +304,20 @@ async def input_generator():
304
304
305
305
await self ._run_stream (stream )
306
306
except (Aborted , Exception ) as e :
307
- error_message = (
308
- "google stt connection aborted"
309
- if isinstance (e , Aborted )
310
- else "google stt connection error"
311
- )
312
- logger .error (
313
- f"{ error_message } . Failed after { retry_count } /{ max_retry } retries."
314
- if retry_count >= max_retry
315
- else error_message ,
316
- exc_info = e if retry_count >= max_retry else None ,
317
- )
307
+ error_type = "Aborted" if isinstance (e , Aborted ) else "Error"
308
+
318
309
if retry_count >= max_retry :
310
+ logger .error (
311
+ f"Failed to connect to Google STT after { max_retry } tries due to { error_type } " ,
312
+ exc_info = e ,
313
+ )
319
314
break
320
315
321
316
retry_delay = min (retry_count * 2 , 5 ) # max 5s
317
+ logger .warning (
318
+ f"Google STT connection { error_type .lower ()} (attempt { retry_count } /{ max_retry } ), retrying in { retry_delay } s" ,
319
+ exc_info = e ,
320
+ )
322
321
retry_count += 1
323
322
await asyncio .sleep (retry_delay )
324
323
You can’t perform that action at this time.
0 commit comments