mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
Attempt to relieve pressure on mpsc_network_worker (#13725)
* Attempt to relieve pressure on `mpsc_network_worker` `SyncingEngine` interacting with `NetworkWorker` can put a lot of strain on the channel if the number of inbound connections is high. This is because `SyncingEngine` is notified of each inbound substream which it then can either accept or reject and this causes a lot of message exchange on the already busy channel. Use a direct channel pair between `Protocol` and `SyncingEngine` to exchange notification events. It is a temporary change to alleviate the problems caused by syncing being an independent protocol and the fix will be removed once `NotificationService` is implemented. * Apply review comments * fixes * trigger ci * Fix tests Verify that both peers have a connection now that the validation goes through `SyncingEngine`. Depending on how the tasks are scheduled, one of them might not have the peer registered in `SyncingEngine` at which point the test won't make any progress because block announcement received from an unknown peer is discarded. Move polling of `ChainSync` at the end of the function so that if a block announcement causes a block request to be sent, that can be sent in the same call to `SyncingEngine::poll()`. --------- Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
//! See the documentation of [`Params`].
|
||||
|
||||
pub use crate::{
|
||||
protocol::NotificationsSink,
|
||||
request_responses::{
|
||||
IncomingRequest, OutgoingResponse, ProtocolConfig as RequestResponseConfig,
|
||||
},
|
||||
@@ -31,7 +32,12 @@ pub use crate::{
|
||||
use codec::Encode;
|
||||
use libp2p::{identity::Keypair, multiaddr, Multiaddr, PeerId};
|
||||
use prometheus_endpoint::Registry;
|
||||
pub use sc_network_common::{role::Role, sync::warp::WarpSyncProvider, ExHashT};
|
||||
pub use sc_network_common::{
|
||||
role::{Role, Roles},
|
||||
sync::warp::WarpSyncProvider,
|
||||
ExHashT,
|
||||
};
|
||||
use sc_utils::mpsc::TracingUnboundedSender;
|
||||
use zeroize::Zeroize;
|
||||
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
@@ -714,6 +720,9 @@ pub struct Params<Block: BlockT> {
|
||||
/// Block announce protocol configuration
|
||||
pub block_announce_config: NonDefaultSetConfig,
|
||||
|
||||
/// TX channel for direct communication with `SyncingEngine` and `Protocol`.
|
||||
pub tx: TracingUnboundedSender<crate::event::SyncEvent<Block>>,
|
||||
|
||||
/// Request response protocol configurations
|
||||
pub request_response_protocol_configs: Vec<RequestResponseConfig>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user