mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-25 23:39:22 -05:00
better peer minimum refresh
This commit is contained in:
parent
f7a6f094ee
commit
9d0479fc45
@ -698,16 +698,7 @@ impl BucketEntryInner {
|
||||
pub(super) fn needs_ping(&self, cur_ts: Timestamp) -> bool {
|
||||
// See which ping pattern we are to use
|
||||
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 {
|
||||
BucketEntryState::Reliable => {
|
||||
// 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
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,14 +546,24 @@ impl RoutingTableInner {
|
||||
if !e.exists_in_routing_domain(rti, routing_domain) {
|
||||
return false;
|
||||
}
|
||||
// If this entry needs need a ping then do it
|
||||
if e.needs_ping(cur_ts) {
|
||||
return true;
|
||||
|
||||
// If we don't have node status for this node, then we should ping it to get some node status
|
||||
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 !e.has_seen_our_node_info_ts(routing_domain, own_node_info_ts) {
|
||||
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
|
||||
}) {
|
||||
node_refs.push(NodeRef::new(
|
||||
|
Loading…
Reference in New Issue
Block a user