Skip to content

Commit

Permalink
Improve HistorySync debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
fiaxh committed Nov 22, 2021
1 parent 8fdc1f4 commit ef87dee
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions consensus/src/sync/history/sync_clustering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,13 @@ impl<TNetwork: Network> HistorySync<TNetwork> {
debug!("Adding new cluster: {:#?}", cluster);
for agent in cluster.peers() {
if let Some(agent) = Weak::upgrade(agent) {
let pair = self
.agents
.get_mut(&agent.peer)
.expect("Agent should be present");
let pair = self.agents.get_mut(&agent.peer).unwrap_or_else(|| {
panic!(
"Agent should be present {:?} cluster {}",
agent.peer.id(),
cluster.id
)
});
pair.1 += 1;
}
}
Expand Down Expand Up @@ -423,17 +426,23 @@ impl<TNetwork: Network> HistorySync<TNetwork> {
result: SyncClusterResult,
) {
if result != SyncClusterResult::NoMoreEpochs {
debug!("Failed to push epoch: {:?}", result);
debug!(
"Failed to push epoch from cluster {}: {:?}",
cluster.id, result
);
}

// Decrement the cluster count for all peers in the cluster.
for peer in cluster.peers() {
if let Some(agent) = Weak::upgrade(peer) {
let cluster_count = {
let pair = self
.agents
.get_mut(&agent.peer)
.expect("Agent should be present");
let pair = self.agents.get_mut(&agent.peer).unwrap_or_else(|| {
panic!(
"Agent should be present {:?} cluster {}",
agent.peer.id(),
cluster.id
)
});
pair.1 -= 1;
pair.1
};
Expand Down

0 comments on commit ef87dee

Please sign in to comment.