-
Notifications
You must be signed in to change notification settings - Fork 226
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
Conversation
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) { |
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.
this reads backwards?
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.
bleh, fixed
23afcb5
to
3e785dd
Compare
Unfortunately, constructing a router is _not_ cheap. Cache it so we don't have to re-compute it every time we get a query.
3e785dd
to
9461bab
Compare
fix #575 |
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.
@Stebalien you should also confirm tests look okay. i don't think you can 'approve' since you opened the PR though
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.