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", "{} {} {}",
|
info!(target: "import", "{} {} {}",
|
||||||
match importing {
|
match importing {
|
||||||
true => format!("{} {} {} {}+{} Qed",
|
true => format!("Syncing {} {} {} {}+{} Qed",
|
||||||
paint(White.bold(), format!("{:>8}", format!("#{}", chain_info.best_block_number))),
|
paint(White.bold(), format!("{:>8}", format!("#{}", chain_info.best_block_number))),
|
||||||
paint(White.bold(), format!("{}", chain_info.best_block_hash)),
|
paint(White.bold(), format!("{}", chain_info.best_block_hash)),
|
||||||
{
|
{
|
||||||
@ -156,11 +156,10 @@ impl Informant {
|
|||||||
impl ChainNotify for 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) {
|
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();
|
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 queue_info = self.client.queue_info();
|
||||||
let importing = queue_info.unverified_queue_size + queue_info.verified_queue_size > 3
|
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());
|
|| 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()))) {
|
if let Some(block) = enacted.last().and_then(|h| self.client.block(BlockID::Hash(h.clone()))) {
|
||||||
let view = BlockView::new(&block);
|
let view = BlockView::new(&block);
|
||||||
let header = view.header();
|
let header = view.header();
|
||||||
@ -178,7 +177,6 @@ impl ChainNotify for Informant {
|
|||||||
);
|
);
|
||||||
*last_import = Instant::now();
|
*last_import = Instant::now();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
self.skipped.store(0, AtomicOrdering::Relaxed);
|
self.skipped.store(0, AtomicOrdering::Relaxed);
|
||||||
} else {
|
} else {
|
||||||
self.skipped.fetch_add(enacted.len(), AtomicOrdering::Relaxed);
|
self.skipped.fetch_add(enacted.len(), AtomicOrdering::Relaxed);
|
||||||
|
Loading…
Reference in New Issue
Block a user