Fix cluster pipeline retries for connection timeouts#284
Fix cluster pipeline retries for connection timeouts#284
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns cluster pipeline retry behavior with single-command execution so that connection checkout timeouts trigger topology refresh + retry, and adds regression coverage for both sync and asyncio clients.
Changes:
- Introduces a shared
REINITIALIZE_ERRORStuple onAbstractValkeyClusterand reuses it inClusterPipeline. - Updates
ClusterPipeline.send_cluster_commands()/_send_cluster_commands()to reinitialize and retry on connection checkoutTimeoutError(and other reinit-worthy errors). - Adds sync regression tests for
get_connection()timeout retry/raise behavior and an asyncio guard test for timeout retry behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
valkey/cluster.py |
Unifies retryable reinit errors and extends pipeline retry/reinitialize behavior to include connection checkout timeouts. |
tests/test_cluster.py |
Adds sync regression tests covering timeout retry and exhausted-retry behavior for pipeline connection acquisition. |
tests/test_asyncio/test_cluster.py |
Adds asyncio test ensuring pipeline retries on TimeoutError during execution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #284 +/- ##
==========================================
+ Coverage 76.40% 76.45% +0.05%
==========================================
Files 129 129
Lines 34065 34125 +60
==========================================
+ Hits 26027 26090 +63
+ Misses 8038 8035 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reuse the shared cluster reinitialize error set so pipeline connection checkout timeouts refresh topology and retry like single commands. Add sync regression coverage for get_connection() timeouts and an asyncio guard test for existing retry behavior. Fixes #261 Signed-off-by: Mikhail Koviazin <github@mkmk.aleeas.com>
Signed-off-by: Mikhail Koviazin <github@mkmk.aleeas.com>
Signed-off-by: Mikhail Koviazin <github@mkmk.aleeas.com>
e029e22 to
134016b
Compare
Reuse the shared cluster reinitialize error set so pipeline connection checkout timeouts refresh topology and retry like single commands. Add sync regression coverage for get_connection() timeouts and an asyncio guard test for existing retry behavior.
Fixes #261
Pull Request check-list
Description of change