Skip to content

Commit

Permalink
Limit in-flight requests in chat app (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeegomo authored Jan 19, 2024
1 parent d527050 commit aeaf13f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nomos-cli/src/cmds/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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::<Vec<_>>()
.await;

Expand Down

0 comments on commit aeaf13f

Please sign in to comment.