Adjust number of slots in sync requests channel (#8492)

This commit is contained in:
Pierre Krieger
2021-04-05 18:31:14 +02:00
committed by GitHub
parent 6d26adce01
commit 6092b56dda
@@ -121,14 +121,9 @@ impl<B: BlockT> BlockRequestHandler<B> {
client: Arc<dyn Client<B>>,
num_peer_hint: usize,
) -> (Self, ProtocolConfig) {
// Rate of arrival multiplied with the waiting time in the queue equals the queue length.
//
// An average Polkadot node serves less than 5 requests per second. The 95th percentile
// serving a request is less than 2 second. Thus one would estimate the queue length to be
// below 10.
//
// Choosing 20 as the queue length to give some additional buffer.
let (tx, request_receiver) = mpsc::channel(20);
// Reserve enough request slots for one request per peer when we are at the maximum
// number of peers.
let (tx, request_receiver) = mpsc::channel(num_peer_hint);
let mut protocol_config = generate_protocol_config(protocol_id);
protocol_config.inbound_queue = Some(tx);