diff --git a/nomos-cli/src/cmds/chat/mod.rs b/nomos-cli/src/cmds/chat/mod.rs index c89619e4..d9a114d3 100644 --- a/nomos-cli/src/cmds/chat/mod.rs +++ b/nomos-cli/src/cmds/chat/mod.rs @@ -48,6 +48,8 @@ use ratatui::{ use tui_input::{backend::crossterm::EventHandler, Input}; const DEFAULT_TIMEOUT: Duration = Duration::from_secs(120); +// Limit the number of maximum in-flight requests +const MAX_BUFFERED_REQUESTS: usize = 20; #[derive(Clone, Debug, Args)] /// The almost-instant messaging protocol. @@ -299,7 +301,7 @@ async fn fetch_new_messages( process_block_blobs(node, block, da_settings) }) - .buffer_unordered(new_blocks.len()) + .buffered(MAX_BUFFERED_REQUESTS) .collect::>() .await;