Skip to content

Commit

Permalink
Quieter block ingestor
Browse files Browse the repository at this point in the history
  • Loading branch information
timmclean authored and Jannis Pohlmann committed Oct 6, 2018
1 parent d80613f commit 68f45b1
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions datasource/ethereum/src/block_ingestor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ where
static_self.do_poll().then(move |result| {
if let Err(e) = result {
// Some polls will fail due to transient issues
warn!(
debug!(
static_self.logger,
"Trying again after block polling failed: {:?}", e
);
Expand All @@ -82,22 +82,6 @@ where
self.get_latest_block()
// Compare latest block with head ptr, alert user if far behind
.and_then(move |latest_block: Block<Transaction>| -> Box<Future<Item=_, Error=_> + Send> {
match head_block_ptr_opt {
None => {
info!(self.logger, "Downloading latest blocks from Ethereum. This may take a few minutes...");
}
Some(head_block_ptr) => {
let latest_number = latest_block.number.unwrap().as_u64() as i64;
let head_number = head_block_ptr.number as i64;
let distance = latest_number - head_number;
if distance > 10 && distance <= 50 {
info!(self.logger, "Downloading latest blocks from Ethereum. This may take a few seconds...");
} else if distance > 50 {
info!(self.logger, "Downloading latest blocks from Ethereum. This may take a few minutes...");
}
}
}

// If latest block matches head block in store
if Some((&latest_block).into()) == head_block_ptr_opt {
// We're done
Expand Down

0 comments on commit 68f45b1

Please sign in to comment.