fix(plugins/sarvam): shorten TTS WS pool duration to 50s and refresh on get#5704
Open
dvirarad wants to merge 1 commit into
Open
fix(plugins/sarvam): shorten TTS WS pool duration to 50s and refresh on get#5704dvirarad wants to merge 1 commit into
dvirarad wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5681.
The Sarvam TTS plugin configures its WebSocket
ConnectionPoolwithmax_session_duration=3600(1 hour) andmark_refreshed_on_get=False. Sarvam's server, however, closes idle WebSockets after 60 seconds, so the pool routinely hands out connections that are already dead, producing:on nearly every turn after a conversation pause longer than 60 s, which translates to 2–6 seconds of silence per call.
Fix
Align the pool config with the other streaming-WS TTS plugins (Cartesia, Neuphonic, Murf, AsyncAI) that don't have this issue:
50s(instead of the 300s used by other plugins) keeps a safety margin below Sarvam's 60s idle cutoff.mark_refreshed_on_get=Trueensures an actively used connection isn't recycled mid-conversation.Out of scope (follow-up)
The issue also mentions Sarvam's
{"type": "ping"}keepalive frame as the most robust long-term solution (similar to pipecat-ai/pipecat#3730). That's a larger change — happy to follow up with a dedicated PR adding a keepalive task if this minimal fix is accepted first.Test plan