mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 22:11:06 +00:00
Remove warning about networking taking a lot of time (#6630)
* Remove warning about networking taking a lot of time * Fix warnings
This commit is contained in:
@@ -38,13 +38,12 @@ use std::{io, pin::Pin};
|
|||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use wasm_timer::Instant;
|
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
use futures::{Future, FutureExt, Stream, StreamExt, stream, compat::*};
|
use futures::{Future, FutureExt, Stream, StreamExt, stream, compat::*};
|
||||||
use sc_network::{NetworkStatus, network_state::NetworkState, PeerId};
|
use sc_network::{NetworkStatus, network_state::NetworkState, PeerId};
|
||||||
use log::{log, warn, debug, error, Level};
|
use log::{warn, debug, error};
|
||||||
use codec::{Encode, Decode};
|
use codec::{Encode, Decode};
|
||||||
use sp_runtime::generic::BlockId;
|
use sp_runtime::generic::BlockId;
|
||||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
|
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
|
||||||
@@ -156,7 +155,7 @@ pub struct ServiceComponents<TBl: BlockT, TBackend: Backend<TBl>, TSc, TExPool,
|
|||||||
pub client: Arc<TCl>,
|
pub client: Arc<TCl>,
|
||||||
/// A shared transaction pool instance.
|
/// A shared transaction pool instance.
|
||||||
pub transaction_pool: Arc<TExPool>,
|
pub transaction_pool: Arc<TExPool>,
|
||||||
/// The chain task manager.
|
/// The chain task manager.
|
||||||
pub task_manager: TaskManager,
|
pub task_manager: TaskManager,
|
||||||
/// A keystore that stores keys.
|
/// A keystore that stores keys.
|
||||||
pub keystore: sc_keystore::KeyStorePtr,
|
pub keystore: sc_keystore::KeyStorePtr,
|
||||||
@@ -216,8 +215,6 @@ async fn build_network_future<
|
|||||||
};
|
};
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let before_polling = Instant::now();
|
|
||||||
|
|
||||||
futures::select!{
|
futures::select!{
|
||||||
// List of blocks that the client has imported.
|
// List of blocks that the client has imported.
|
||||||
notification = imported_blocks_stream.next() => {
|
notification = imported_blocks_stream.next() => {
|
||||||
@@ -334,15 +331,6 @@ async fn build_network_future<
|
|||||||
ready_sink.send((status, state));
|
ready_sink.send((status, state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now some diagnostic for performances.
|
|
||||||
let polling_dur = before_polling.elapsed();
|
|
||||||
log!(
|
|
||||||
target: "service",
|
|
||||||
if polling_dur >= Duration::from_secs(1) { Level::Warn } else { Level::Trace },
|
|
||||||
"⚠️ Polling the network future took {:?}",
|
|
||||||
polling_dur
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user