Conversation
a4f2164 to
efe4369
Compare
| @@ -4,12 +4,25 @@ | |||
| nano::store::lmdb::peer::peer (nano::store::lmdb::component & store) : | |||
| store{ store } {}; | |||
There was a problem hiding this comment.
spurious semicolon
lesser point: the braces placement looks a bit strange stylistically
|
Should @gr0vity-dev heads-up: this might affect your scripts, I think you interact directly with the peers table, right? |
|
Thanks for the heads-up. |
clemahieu
left a comment
There was a problem hiding this comment.
This looks like a good cleanup.
Only thing I noticed was on naming, is this really a cache? Maybe peer_history?
Not a blocker.
|
We do not really need to store the timestamp into the database, it can be kept in RAM only. |
|
I think we should be storing the peer node ID in the peer database too. |
nano/node/network.cpp
Outdated
| } | ||
| lock.unlock (); | ||
|
|
||
| node.stats.inc (nano::stat::type::network, nano::stat::detail::loop_reachout); |
There was a problem hiding this comment.
Should this counter be loop_reachout_cached?
# Conflicts: # nano/lib/thread_roles.cpp # nano/lib/thread_roles.hpp
|
I fixed a few minor issues pointed by the review and renamed class to |
This introduces a new
peer_cachecomponent that is responsible for managing cached peers. Previously storing peers was done bytcp_channelsand loading bynode, which is not the core responsibility of these classes.Previous behavior was that only the latest set of peers was stored (ie. cache was cleared before every write). Now the cache keeps track of peers up to a certain cutoff age (by default 1 hour).
Another behavior change is that network reachout thread tries to contact cached peers. Previously this was only done once, on node startup. This should help with resiliency if for some reason node temporarily loses connection to its peers (eg. due to network outage).