-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
peerstore: limit number of non connected peers in addrbook #2971
Conversation
core/peerstore/peerstore.go
Outdated
@@ -133,13 +138,17 @@ type AddrBook interface { | |||
// cab.ConsumePeerRecord(signedPeerRecord, aTTL) | |||
// } | |||
type CertifiedAddrBook interface { | |||
// A CertifiedAddrBook is an address book. To remove peers, use the available | |||
// methods on the AddrBook. | |||
AddrBook |
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.
Do we need this?
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.
I've removed this
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.
There's no way to remove a certified peer record from the CertifiedAddrBook
. You cannot use the CertifiedAddrBook
without an AddrBook
, so I made it an AddrBook
.
heapIndex int | ||
} | ||
|
||
func (e *expiringAddr) ExpiredBy(t time.Time) bool { | ||
return !t.Before(e.Expiry) | ||
} | ||
|
||
var expiringAddrPool = sync.Pool{New: func() any { return &expiringAddr{} }} |
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.
Can you expand a bit what prompted the change to add a pool? And did you see a perf difference in the benchmark?
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.
I didn't have a benchmark. I'll add one.
5f91eda
to
9bed4bc
Compare
No description provided.