fix(asyncio-cluster): await stale node teardown before replacing cluster nodes#283
fix(asyncio-cluster): await stale node teardown before replacing cluster nodes#283
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #283 +/- ##
==========================================
+ Coverage 76.41% 76.45% +0.03%
==========================================
Files 129 129
Lines 34065 34158 +93
==========================================
+ Hits 26031 26114 +83
- Misses 8034 8044 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses an asyncio cluster reinitialization regression by ensuring stale ClusterNode instances are properly disconnected (and awaited) before being dropped/replaced, preventing Unclosed ClusterNode object warnings during topology refresh.
Changes:
- Remove unnecessary
asyncio.create_task(...)wrapping aroundasyncio.gather(...)calls to avoid fire-and-forget behavior. - Track stale nodes slated for teardown in
NodesManagerand await their disconnects duringinitialize()andaclose(). - Add a regression test asserting
initialize()waits for removed-node disconnect before completing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
valkey/asyncio/cluster.py |
Introduces pending-node teardown tracking and awaits disconnects during topology refresh and close; simplifies gather usage. |
tests/test_asyncio/test_cluster.py |
Adds a new test case and helper connection to verify initialization blocks until stale node teardown finishes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot review |
All three review suggestions have been addressed in commit
|
…y valkey.asyncio.cluster.ClusterNode.__del__() Signed-off-by: Mikhail Koviazin <[email protected]>
Signed-off-by: Mikhail Koviazin <[email protected]>
Signed-off-by: Mikhail Koviazin <[email protected]>
2ccc88a to
80e7f03
Compare
Avoid fire-and-forget disconnects when refreshing the async cluster topology.
This keeps removed ClusterNode instances alive until teardown finishes and fixes the unclosed node warning regression during reinitialization.
Fixes #185
Pull Request check-list
Description of change