fix: retry connection pool prewarm after failure - #6969
Open
jstar0 wants to merge 1 commit into
Open
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
ConnectionPool.prewarm()records an in-flight task to suppress duplicate work. When that task completes or fails, the task reference was retained, so later prewarm calls permanently skipped the pool even though no prewarm operation was still running.This change clears the completed task reference before deciding whether to return, allowing a later call to retry after failure or perform a fresh prewarm after completion. The patch is limited to the connection-pool lifecycle and adds a regression for retry-after-failure behavior.
Testing
uv run pytest tests/test_connection_pool.py --unit- 7 passed.uv run ruff check livekit-agents/livekit/agents/utils/connection_pool.py tests/test_connection_pool.py- passed.uv run ruff format --check livekit-agents/livekit/agents/utils/connection_pool.py tests/test_connection_pool.py- passed.make checkformat and lint stages pass on the current head. The repository-wide type stage remains blocked by the existing missingboto3import in the experimental AWS realtime plugin, outside this patch.git diff --check origin/main...HEAD- passed.No external provider, LiveKit server, network credential, or integration account is required for this unit-level lifecycle regression.
The submitted commit is SSH-signed with the configured GitHub signing identity.
Compatibility
This is backward compatible. Successful prewarm behavior is unchanged; failed or completed prewarm tasks can now be retried instead of suppressing all future attempts.