2
0
mirror of https://github.com/Revertron/Alfis synced 2024-11-09 07:10:30 +00:00

Fixed very chatty logging of network status.

This commit is contained in:
Revertron 2022-05-12 16:42:05 +02:00
parent 72a39fad33
commit 3e1f93f988

View File

@ -174,8 +174,13 @@ impl Network {
let keys = context.chain.get_users_count();
let domains = context.chain.get_domains_count();
if old_nodes != nodes || old_blocks != blocks || old_banned != banned || old_domains != domains || old_keys != keys {
info!("Active nodes: {}, banned: {}, blocks: {}, domains: {}, keys: {}", nodes, banned, blocks, domains, keys);
let nodes_changed = old_nodes != nodes;
let other_changed = old_blocks != blocks || old_banned != banned || old_domains != domains || old_keys != keys;
if nodes_changed || other_changed {
// Don't log every current connection count change
if log_timer.elapsed().as_secs() > LOG_REFRESH_DELAY_SEC || other_changed {
info!("Active nodes: {}, banned: {}, blocks: {}, domains: {}, keys: {}", nodes, banned, blocks, domains, keys);
}
post(crate::event::Event::NetworkStatus { blocks, domains, keys, nodes });
old_nodes = nodes;
old_blocks = blocks;