better peer minimum refresh

This commit is contained in:
John Smith 2023-07-19 12:32:03 -04:00
parent f7a6f094ee
commit 9d0479fc45
2 changed files with 18 additions and 14 deletions

View File

@ -699,15 +699,6 @@ impl BucketEntryInner {
// See which ping pattern we are to use // See which ping pattern we are to use
let state = self.state(cur_ts); let state = self.state(cur_ts);
// If we don't have node status for this node, then we should ping it to get some node status
for routing_domain in RoutingDomainSet::all() {
if self.has_node_info(routing_domain.into()) {
if self.node_status(routing_domain).is_none() {
return true;
}
}
}
match state { match state {
BucketEntryState::Reliable => { BucketEntryState::Reliable => {
// If we are in a reliable state, we need a ping on an exponential scale // If we are in a reliable state, we need a ping on an exponential scale
@ -742,7 +733,10 @@ impl BucketEntryInner {
// If we are in an unreliable state, we need a ping every UNRELIABLE_PING_INTERVAL_SECS seconds // If we are in an unreliable state, we need a ping every UNRELIABLE_PING_INTERVAL_SECS seconds
self.needs_constant_ping(cur_ts, TimestampDuration::new(UNRELIABLE_PING_INTERVAL_SECS as u64 * 1000000u64)) self.needs_constant_ping(cur_ts, TimestampDuration::new(UNRELIABLE_PING_INTERVAL_SECS as u64 * 1000000u64))
} }
BucketEntryState::Dead => false, BucketEntryState::Dead => {
error!("Should not be asking this for dead nodes");
false
}
} }
} }

View File

@ -546,14 +546,24 @@ impl RoutingTableInner {
if !e.exists_in_routing_domain(rti, routing_domain) { if !e.exists_in_routing_domain(rti, routing_domain) {
return false; return false;
} }
// If this entry needs need a ping then do it
if e.needs_ping(cur_ts) { // If we don't have node status for this node, then we should ping it to get some node status
return true; if e.has_node_info(routing_domain.into()) {
if e.node_status(routing_domain).is_none() {
return true;
}
} }
// If this entry needs a ping because this node hasn't seen our latest node info, then do it // If this entry needs a ping because this node hasn't seen our latest node info, then do it
if !e.has_seen_our_node_info_ts(routing_domain, own_node_info_ts) { if !e.has_seen_our_node_info_ts(routing_domain, own_node_info_ts) {
return true; return true;
} }
// If this entry needs need a ping by non-routing-domain-specific metrics then do it
if e.needs_ping(cur_ts) {
return true;
}
false false
}) { }) {
node_refs.push(NodeRef::new( node_refs.push(NodeRef::new(