Skip to content

Commit

Permalink
Update log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
varsha888 committed Apr 1, 2023
1 parent 5d9a822 commit 5a71ef4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 17 deletions.
6 changes: 5 additions & 1 deletion ledger/sync/src/ledger_sync/ledger_sync_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use mc_util_telemetry::{
use mc_util_uri::ConnectionUri;
use retry::delay::Fibonacci;
use std::{
cmp::min,
collections::{BTreeMap, HashMap, HashSet},
sync::{Arc, Condvar, Mutex},
thread,
Expand All @@ -41,6 +42,8 @@ const MAX_CONCURRENT_GET_BLOCK_CONTENTS_CALLS: usize = 50;
/// Telemetry metadata: number of blocks appended to the local ledger.
const TELEMETRY_NUM_BLOCKS_APPENDED: Key = telemetry_static_key!("num-blocks-appended");

const MAX_SLEEP_INTERVAL: Duration = Duration::from_secs(60);

pub struct LedgerSyncService<
L: Ledger,
BC: BlockchainConnection + 'static,
Expand Down Expand Up @@ -719,7 +722,8 @@ fn get_block_contents<TF: TransactionsFetcher + 'static>(
// Sleep, with a linearly increasing delay. This prevents
// endless retries
// as long as the deadline is not exceeded.
thread::sleep(Duration::from_secs(num_attempts + 1));
let attempts = Duration::from_secs(num_attempts + 1);
thread::sleep(min(attempts, MAX_SLEEP_INTERVAL));

// Put back to queue for a retry
thread_sender
Expand Down
2 changes: 1 addition & 1 deletion mobilecoind/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl SyncThread {
}

// This monitor has blocks to process, put it in the queue.
log::info!(
log::debug!(
logger,
"sync thread noticed monitor {} needs syncing",
monitor_id,
Expand Down
2 changes: 1 addition & 1 deletion watcher/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl WatcherSyncThread {
// Decide next step before continuing based on sync result
match sync_result {
SyncResult::AllBlocksSynced => {
log::info!(logger, "sync_blocks indicates we're done");
log::info!(logger, "Block synchronization done");
break;
}
SyncResult::BlockSyncError => {
Expand Down
18 changes: 10 additions & 8 deletions watcher/src/verification_reports_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,16 @@ impl<NC: NodeClient> VerificationReportsCollectorThread<NC> {
verification_report: &VerificationReport,
) {
let verification_report_block_signer = match NC::get_block_signer(verification_report) {
Ok(key) => key,
Ok(key) => {
// TODO: Add encode to key's Display impl
log::info!(
self.logger,
"Verification report from {} has block signer {}",
node_url,
hex::encode(key.to_bytes())
);
key
}
Err(err) => {
log::error!(
self.logger,
Expand All @@ -320,13 +329,6 @@ impl<NC: NodeClient> VerificationReportsCollectorThread<NC> {
}
};

log::info!(
self.logger,
"Verification report from {} has block signer {}",
node_url,
hex::encode(verification_report_block_signer.to_bytes())
);

// Store the VerificationReport in the database, and also remove
// verification_report_block_signer and potential_signers from the polling
// queue.
Expand Down
24 changes: 18 additions & 6 deletions watcher/src/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,24 @@ impl Watcher {
max_blocks_per_iteration: Option<usize>,
log_sync_failures: bool,
) -> Result<SyncResult, WatcherError> {
log::info!(
self.logger,
"Now syncing signatures from {} to {:?}",
start,
max_block_height,
);
match max_block_height {
None => {
log::debug!(
self.logger,
"Now syncing signatures from {} to {:?}",
start,
max_block_height,
);
}
Some(_) => {
log::info!(
self.logger,
"Now syncing signatures from {} to {:?}",
start,
max_block_height,
);
}
}

let mut counter = 0usize;

Expand Down

0 comments on commit 5a71ef4

Please sign in to comment.