Skip to content

Commit

Permalink
[Consensus] minor fixes (#19742)
Browse files Browse the repository at this point in the history
## Description 

- Avoid busy looping in commit sync, when failing to fetch from every
peer.
- Make the error to serve connections debug, because the issue is on the
requestor's side.


## Test plan 

CI

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
mwtian authored Oct 8, 2024
1 parent 60867d4 commit faa3eb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions consensus/core/src/commit_syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,12 @@ impl<C: NetworkClient> CommitSyncer<C> {
.hostname
.clone();
warn!("Failed to fetch {commit_range:?} from {hostname}: {}", e);
let error: &'static str = e.into();
inner
.context
.metrics
.node_metrics
.commit_sync_fetch_once_errors
.with_label_values(&[&hostname, error])
.with_label_values(&[&hostname, e.name()])
.inc();
}
Err(_) => {
Expand All @@ -466,6 +465,8 @@ impl<C: NetworkClient> CommitSyncer<C> {
}
}
}
// Avoid busy looping, by waiting for a while before retrying.
sleep(TIMEOUT).await;
}
}

Expand Down
2 changes: 1 addition & 1 deletion consensus/core/src/network/tonic_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ impl<S: NetworkService> NetworkManager<S> for TonicManager {
match result {
Ok(Ok(())) => {},
Ok(Err(e)) => {
warn!("Error serving connection: {e:?}");
debug!("Error serving connection: {e:?}");
},
Err(e) => {
debug!("Connection task error, likely shutting down: {e:?}");
Expand Down

0 comments on commit faa3eb0

Please sign in to comment.