Informant tidyup. (#1699)
* Informant tidyup. Clean indent. Don't skip skipping. * Move string to right place [ci:skip]
This commit is contained in:
parent
3f841cc578
commit
9cdd2d265a
@ -108,7 +108,7 @@ impl Informant {
|
||||
|
||||
info!(target: "import", "{} {} {}",
|
||||
match importing {
|
||||
true => format!("{} {} {} {}+{} Qed",
|
||||
true => format!("Syncing {} {} {} {}+{} Qed",
|
||||
paint(White.bold(), format!("{:>8}", format!("#{}", chain_info.best_block_number))),
|
||||
paint(White.bold(), format!("{}", chain_info.best_block_hash)),
|
||||
{
|
||||
@ -156,11 +156,10 @@ impl Informant {
|
||||
impl ChainNotify for Informant {
|
||||
fn new_blocks(&self, _imported: Vec<H256>, _invalid: Vec<H256>, enacted: Vec<H256>, _retracted: Vec<H256>, _sealed: Vec<H256>, duration: u64) {
|
||||
let mut last_import = self.last_import.lock();
|
||||
if Instant::now() > *last_import + Duration::from_secs(1) {
|
||||
let queue_info = self.client.queue_info();
|
||||
let importing = queue_info.unverified_queue_size + queue_info.verified_queue_size > 3
|
||||
|| self.sync.as_ref().map_or(false, |s| s.status().is_major_syncing());
|
||||
if !importing {
|
||||
if Instant::now() > *last_import + Duration::from_secs(1) && !importing {
|
||||
if let Some(block) = enacted.last().and_then(|h| self.client.block(BlockID::Hash(h.clone()))) {
|
||||
let view = BlockView::new(&block);
|
||||
let header = view.header();
|
||||
@ -178,7 +177,6 @@ impl ChainNotify for Informant {
|
||||
);
|
||||
*last_import = Instant::now();
|
||||
}
|
||||
}
|
||||
self.skipped.store(0, AtomicOrdering::Relaxed);
|
||||
} else {
|
||||
self.skipped.fetch_add(enacted.len(), AtomicOrdering::Relaxed);
|
||||
|
Loading…
Reference in New Issue
Block a user