Skip to content

peerstore: limit number of non connected peers in addrbook - #2971

Merged
MarcoPolo merged 8 commits into
masterfrom
sukun/peerstore-limit
Oct 17, 2024
Merged

MarcoPolo merged 8 commits into
masterfrom
sukun/peerstore-limit

Conversation

@sukunrt

@sukunrt sukunrt commented Sep 19, 2024

Copy link
Copy Markdown
Member

No description provided.

@sukunrt
sukunrt marked this pull request as ready for review September 25, 2024 18:13
@sukunrt
sukunrt requested a review from MarcoPolo September 30, 2024 16:18
@MarcoPolo MarcoPolo mentioned this pull request Oct 9, 2024
19 of 30 tasks
Comment thread core/peerstore/peerstore.go Outdated
type CertifiedAddrBook interface {
// A CertifiedAddrBook is an address book. To remove peers, use the available
// methods on the AddrBook.
AddrBook

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this

Copy link
Copy Markdown
Member Author

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.

return !t.Before(e.Expiry)
}

var expiringAddrPool = sync.Pool{New: func() any { return &expiringAddr{} }}

Copy link
Copy Markdown
Collaborator

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?

Copy link
Copy Markdown
Member Author

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.

@MarcoPolo
MarcoPolo force-pushed the sukun/peerstore-limit branch from 5f91eda to 9bed4bc Compare October 17, 2024 02:51
@MarcoPolo
MarcoPolo merged commit 26c9014 into master Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants