Skip to content
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

fix: use the routing table filter #576

Merged
merged 4 commits into from
Apr 9, 2020
Merged

fix: use the routing table filter #576

merged 4 commits into from
Apr 9, 2020

Conversation

Stebalien
Copy link
Member

Also, cache routing info so we don't need to repeatedly recompute it.

We should also consider caching known-filtered peers... but we can do that after
profiling.

@Stebalien Stebalien requested a review from willscott April 8, 2020 23:17
@Stebalien
Copy link
Member Author

This should get some tests. I hate to do this, but could you write them @willscott?

dht_filters.go Outdated
expires := routerCache.expires
routerCache.RUnlock()

if router != nil && time.Now().After(expires) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this reads backwards?

Copy link
Member Author

Choose a reason for hiding this comment

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

bleh, fixed

Unfortunately, constructing a router is _not_ cheap. Cache it so we don't have
to re-compute it every time we get a query.
@willscott
Copy link
Contributor

fix #575

Copy link
Contributor

@willscott willscott left a comment

Choose a reason for hiding this comment

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

@Stebalien you should also confirm tests look okay. i don't think you can 'approve' since you opened the PR though

@willscott willscott merged commit 796b95b into master Apr 9, 2020
@Stebalien Stebalien deleted the feat/filter-rt branch April 9, 2020 01:28
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