fix(net): max inflight requests (#8139)

This commit is contained in:
Emilia Hane
2024-05-07 20:05:56 +02:00
committed by GitHub
parent e172a8e38a
commit 1188898dad

View File

@ -1294,27 +1294,26 @@ pub enum VerificationOutcome {
/// Tracks stats about the [`TransactionFetcher`].
#[derive(Debug)]
pub struct TransactionFetcherInfo {
/// Currently active outgoing [`GetPooledTransactions`] requests.
/// Max inflight [`GetPooledTransactions`] requests.
pub max_inflight_requests: usize,
/// Soft limit for the byte size of the expected
/// [`PooledTransactions`] response on packing a
/// [`GetPooledTransactions`] request with hashes.
pub(super) soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize,
/// Soft limit for the byte size of a [`PooledTransactions`]
/// response on assembling a [`GetPooledTransactions`]
/// request. Spec'd at 2 MiB.
/// Soft limit for the byte size of the expected [`PooledTransactions`] response, upon packing
/// a [`GetPooledTransactions`] request with hashes (by default less than 2 MiB worth of
/// transactions is requested).
pub soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize,
/// Soft limit for the byte size of a [`PooledTransactions`] response, upon assembling the
/// response. Spec'd at 2 MiB, but can be adjusted for research purpose.
pub soft_limit_byte_size_pooled_transactions_response: usize,
}
impl TransactionFetcherInfo {
/// Creates a new max
pub fn new(
max_inflight_transaction_requests: usize,
max_inflight_requests: usize,
soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize,
soft_limit_byte_size_pooled_transactions_response: usize,
) -> Self {
Self {
max_inflight_requests: max_inflight_transaction_requests,
max_inflight_requests,
soft_limit_byte_size_pooled_transactions_response_on_pack_request,
soft_limit_byte_size_pooled_transactions_response,
}
@ -1324,7 +1323,7 @@ impl TransactionFetcherInfo {
impl Default for TransactionFetcherInfo {
fn default() -> Self {
Self::new(
DEFAULT_MAX_COUNT_INFLIGHT_REQUESTS_ON_FETCH_PENDING_HASHES,
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS as usize * DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER as usize,
DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ,
SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE
)