Repository navigation
fix(bootstrap): restore periodic rounds when no backup peers are set - #1220
Open
guillaumemichel wants to merge 2 commits into
Open
guillaumemichel wants to merge 2 commits into
guillaumemichel wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1220 +/- ##
==========================================
+ Coverage 70.54% 70.73% +0.18%
==========================================
Files 270 270
Lines 27265 27264 -1
==========================================
+ Hits 19234 19285 +51
+ Misses 7984 7932 -52
Partials 47 47
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
gammazero
approved these changes
Oct 15, 2026
gammazero
left a comment
Contributor
There was a problem hiding this comment.
Good fix. Yes, looks like moving doneWithRound <- struct{}{} inside if cfg.loadBackupBootstrapPeers != nil was an error.
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.
Problem
Since #710,
bootstrap.Bootstraponly behaves as documented when backup peers are set withWithBackupPeersorSetBackupPeers. Without them:MinPeerThresholdconnections never gets another bootstrap round.Closenever releases it.Bootstrapreturns before the first round completes: while with backup peers it waits for that round.#710 moved the first-round handshake (
doneWithRound <- struct{}{}) insideif cfg.loadBackupBootstrapPeers != niland dropped the unconditionalclose(doneWithRound). Without backup peers, nothing ever sends on or closes that channel. Before #710, every caller waited for the first round and got periodic roundsKubo always sets backup peers, so it isn't affected.
Fix
firstRoundDoneonce the first round completes, then enters the periodic loop. It no longer waits on a handshake.Bootstrapwaits onfirstRoundDonewhether or not backup peers are set, then starts the backup-saving process when they are.rt.Bootstrapfails,Bootstrapcancels the context and returns the error, as before. The supervisor's first round ends early on the cancelled context, then the supervisor closes the channel and exits, so there is nothing left to unblock.For callers without backup peers, two things change, both back to how they were before #710:
Bootstrapwaits for the first round, which can take up toConnectionTimeout.Period, a round checks the connection count, and dials bootstrap peers only when it is belowMinPeerThreshold. Callers with backup peers already get exactly this.Callers with backup peers see no change, and the backup-peer API is unchanged.