fix(network): gracefully handle expired peer in peer_connection_attempt#15390
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #15390 +/- ##
==========================================
+ Coverage 69.00% 69.10% +0.09%
==========================================
Files 934 934
Lines 209206 209728 +522
Branches 209206 209728 +522
==========================================
+ Hits 144360 144923 +563
+ Misses 58861 58814 -47
- Partials 5985 5991 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adjusts PeerStore::peer_connection_attempt to avoid emitting errors when an outbound connection attempt fails after the peer has already been removed (e.g., expired) from the peer store—reducing log noise during sync while preserving an error for unexpected success cases.
Changes:
- Treat “peer missing + connection failed” as a benign race: log at DEBUG and return
Ok(()). - Preserve the existing error (
bail!) when “peer missing + connection succeeded”. - Refactor the function to use a
let Some(..) = .. else { .. }guard for clearer control flow.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
remove_expiredcan delete the peer from the store. When the connection attempt finally completes with a failure,peer_connection_attemptwould bail with an error logged at ERROR level.