This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 112
Be less aggressive when pruning peers from session #276
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1247b02
fix: overly aggressive session peer removal
dirkmc 32e5cae
Disable flaky benchmark
dirkmc 99fe214
fix: block receive shouldn't affect DONT_HAVE count for other peers
dirkmc f74c469
refactor: avoid unnecessary go-routine
dirkmc 916da78
fix: overly aggressive session peer removal
dirkmc 2112d90
Disable flaky benchmark
dirkmc 33443d7
fix: block receive shouldn't affect DONT_HAVE count for other peers
dirkmc 22f0c79
refactor: avoid unnecessary go-routine
dirkmc 44ae8f1
Merge branch 'fix/prune-dont-have' of https://github.com/ipfs/go-bits…
dirkmc cc1224e
fix: flaky test
dirkmc 2e60342
test: fix another flaky test
dirkmc 568a984
fix: flaky test
dirkmc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ func (sw *sessionWants) GetNextWants(limit int) []cid.Cid { | |
func (sw *sessionWants) WantsSent(ks []cid.Cid) { | ||
now := time.Now() | ||
for _, c := range ks { | ||
if _, ok := sw.liveWants[c]; !ok { | ||
if _, ok := sw.liveWants[c]; !ok && sw.toFetch.Has(c) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was causing us to sometimes re-broadcast a want for which a block had already been received |
||
sw.toFetch.Remove(c) | ||
sw.liveWants[c] = now | ||
} | ||
|
@@ -83,8 +83,7 @@ func (sw *sessionWants) BlocksReceived(ks []cid.Cid) ([]cid.Cid, time.Duration) | |
totalLatency += now.Sub(sentAt) | ||
} | ||
|
||
// Remove the CID from the live wants / toFetch queue and add it | ||
// to the past wants | ||
// Remove the CID from the live wants / toFetch queue | ||
delete(sw.liveWants, c) | ||
sw.toFetch.Remove(c) | ||
} | ||
|
@@ -96,6 +95,9 @@ func (sw *sessionWants) BlocksReceived(ks []cid.Cid) ([]cid.Cid, time.Duration) | |
// PrepareBroadcast saves the current time for each live want and returns the | ||
// live want CIDs. | ||
func (sw *sessionWants) PrepareBroadcast() []cid.Cid { | ||
// TODO: Change this to return wants in order so that the session will | ||
// send out Find Providers request for the first want | ||
// (Note that maps return keys in random order) | ||
now := time.Now() | ||
live := make([]cid.Cid, 0, len(sw.liveWants)) | ||
for c := range sw.liveWants { | ||
|
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OT note: this should be an info at best.