fix: if there are peers with the data we seek, but all of them are in…#954
Open
JamesPiechota wants to merge 1 commit intomasterfrom
Open
fix: if there are peers with the data we seek, but all of them are in…#954JamesPiechota wants to merge 1 commit intomasterfrom
JamesPiechota wants to merge 1 commit intomasterfrom
Conversation
… cooldown - wait and try the range again This avoids a death loop that can happen when there aren't many peers available for a range. If they all get throttled the node will iterate through the collect_peer_intervals loop very fast and likely trip the rate limit again as soon as it is lifted - but each time it will be at a different point in the loop which can mean it takes forweaver to enqueue all itnervals for the range. Now with the wait the node will continue to march methodically through the range, waiting as necessary but never skipping ahead.
ldmberman
reviewed
Feb 5, 2026
| not ar_rate_limiter:is_on_cooldown(Peer, RPMKey) andalso | ||
| not ar_rate_limiter:is_throttled(Peer, Path) | ||
| ], | ||
| case length(AllPeers) > 0 andalso length(HotPeers) == 0 of |
Member
There was a problem hiding this comment.
Why do you condition on length(AllPeers)? Does not it make sense to always wait when the discovered peer list is empty?
Collaborator
Author
There was a problem hiding this comment.
I'm expecting there may be some ranges of chunks for where there are currently no peers at all (e.g. perhaps during some of the periods with high sacrifice mining, or perhaps when the node has configured they sync_from_local_peers_only too restrictively) - in that case I didn't want to have the node block indefinitely and instead continue syncing where possible.
Collaborator
Author
|
@cursor review please |
ldmberman
approved these changes
Feb 6, 2026
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.
… cooldown - wait and try the range again
This avoids a death loop that can happen when there aren't many peers available for a range. If they all get throttled the node will iterate through the collect_peer_intervals loop very fast and likely trip the rate limit again as soon as it is lifted - but each time it will be at a different, random, point in the loop which can mean it takes forever to enqueue all intervals for the range.
Now with the
waitthe node will continue to march methodically through the range, waiting as necessary but never skipping ahead.Note
Medium Risk
Touches core sync scheduling/peer selection logic; incorrect wait/backoff behavior could slow syncing or reduce progress under certain peer-availability/rate-limit conditions.
Overview
Prevents
collect_peer_intervalsfrom spinning through ranges when peers exist but are all on cooldown/throttled, by introducing an explicitwaitoutcome from peer selection and retrying the same offset after a delay.Refactors peer selection in
ar_peer_intervalsintoget_peers/2+get_peers2/4shared by bothnormalandfootprintmodes, and adds a small log improvement inar_data_syncto includequeue_sizeand avoid rereadingstore_idfrom the record.Written by Cursor Bugbot for commit 535f343. This will update automatically on new commits. Configure here.