Skip to content

Commit

Permalink
[Perf] Avoid unnecessary storage summary formatting in state sync
Browse files Browse the repository at this point in the history
  • Loading branch information
sitalkedia authored and aptos-bot committed Apr 10, 2022
1 parent 05f6473 commit c97d069
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions state-sync/storage-service/server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@ fn inclusive_range_len(start: u64, end: u64) -> Result<u64, Error> {
fn log_storage_response(storage_response: &Result<StorageServiceResponse, StorageServiceError>) {
match storage_response {
Ok(storage_response) => {
let response = format!("{}", storage_response); // Use display formatting
if matches!(
storage_response,
StorageServiceResponse::StorageServerSummary(_)
Expand All @@ -705,15 +704,17 @@ fn log_storage_response(storage_response: &Result<StorageServiceResponse, Storag
sample!(
SampleRate::Duration(Duration::from_secs(SUMMARY_LOG_FREQUENCY_SECS)),
{
let response = format!("{}", storage_response);
debug!(LogSchema::new(LogEntry::SentStorageResponse).response(&response));
}
);
} else {
let response = format!("{}", storage_response);
debug!(LogSchema::new(LogEntry::SentStorageResponse).response(&response));
}
}
Err(storage_error) => {
let storage_error = format!("{:?}", storage_error); // Use debug formatting
let storage_error = format!("{:?}", storage_error);
debug!(LogSchema::new(LogEntry::SentStorageResponse).response(&storage_error));
}
};
Expand Down

0 comments on commit c97d069

Please sign in to comment.