Skip to content

fix(azure): Handle STT timeout errors with retries - #5333

Closed
aryanjsingh wants to merge 1 commit into
livekit:mainfrom
aryanjsingh:fix/issue-5322-azure-stt-plugin-does-not-handle-timeout
Closed

fix(azure): Handle STT timeout errors with retries#5333
aryanjsingh wants to merge 1 commit into
livekit:mainfrom
aryanjsingh:fix/issue-5322-azure-stt-plugin-does-not-handle-timeout

Conversation

@aryanjsingh

Copy link
Copy Markdown

Summary

This pull request fixes an issue where the Azure STT plugin would hang indefinitely upon receiving a service timeout error. The _on_canceled callback now identifies timeout errors and triggers a reconnect. The SpeechStream's main loop has been updated to implement a retry mechanism with exponential backoff, ensuring the stream can recover from transient network issues or fail gracefully after exhausting retries.

Changes

  • livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/stt.py: The SpeechStream class in the Azure STT plugin has been updated to properly handle ServiceTimeout errors. A retry mechanism with exponential backoff is now implemented in the _run method, which is triggered by the _on_canceled callback when a timeout is detected. This prevents the stream from hanging and allows it to recover from transient network issues or fail gracefully after exhausting all retry attempts.

Related Issue

Closes #5322

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/stt.py
Comment thread livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/stt.py
aryanjsingh

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure STT plugin does not handle timeout error properly

2 participants