Skip to content

Commit

Permalink
define a constant for the bounded channel size
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunwangs committed Jan 15, 2025
1 parent 3e470aa commit a2d1d8f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ use {
quic::{configure_server, QuicServerError, QuicServerParams, StreamerStats},
streamer::StakedNodes,
},
async_channel::{
bounded as async_bounded, Receiver as AsyncReceiver, Sender as AsyncSender,
},
async_channel::{bounded as async_bounded, Receiver as AsyncReceiver, Sender as AsyncSender},
bytes::Bytes,
crossbeam_channel::Sender,
futures::{stream::FuturesUnordered, Future, StreamExt as _},
Expand Down Expand Up @@ -105,6 +103,8 @@ const TOTAL_CONNECTIONS_PER_SECOND: u64 = 2500;
/// entries used by past requests.
const CONNECTION_RATE_LIMITER_CLEANUP_SIZE_THRESHOLD: usize = 100_000;

const MAX_COALESCE_CHANNEL_SIZE: usize = 10_000_000;

// A struct to accumulate the bytes making up
// a packet, along with their offsets, and the
// packet metadata. We use this accumulator to avoid
Expand Down Expand Up @@ -307,7 +307,7 @@ async fn run_server(
.store(endpoints.len(), Ordering::Relaxed);
let staked_connection_table: Arc<Mutex<ConnectionTable>> =
Arc::new(Mutex::new(ConnectionTable::new()));
let (sender, receiver) = async_bounded(10_000_000);
let (sender, receiver) = async_bounded(MAX_COALESCE_CHANNEL_SIZE);
tokio::spawn(packet_batch_sender(
packet_sender,
receiver,
Expand Down

0 comments on commit a2d1d8f

Please sign in to comment.