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

Sync status refactoring #5450

Merged
merged 8 commits into from
Aug 26, 2024
3 changes: 2 additions & 1 deletion substrate/client/network/sync/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ where
}

// Update atomic variables
self.num_connected.store(self.peers.len(), Ordering::Relaxed);
self.is_major_syncing.store(self.strategy.is_major_syncing(), Ordering::Relaxed);

// Process actions requested by a syncing strategy.
Expand Down Expand Up @@ -853,6 +852,7 @@ where
if let Some(metrics) = &self.metrics {
metrics.peers.dec();
}
self.num_connected.fetch_sub(1, Ordering::AcqRel);

if self.important_peers.contains(&peer_id) {
log::warn!(target: LOG_TARGET, "Reserved peer {peer_id} disconnected");
Expand Down Expand Up @@ -1033,6 +1033,7 @@ where
metrics.peers.inc();
}
}
self.num_connected.fetch_add(1, Ordering::AcqRel);
nazar-pc marked this conversation as resolved.
Show resolved Hide resolved
self.peer_store_handle.set_peer_role(&peer_id, status.roles.into());

if self.default_peers_set_no_slot_peers.contains(&peer_id) {
Expand Down