Skip to content

Commit

Permalink
move responder buffer size to const
Browse files Browse the repository at this point in the history
  • Loading branch information
arya2 committed Feb 16, 2024
1 parent 5c617c9 commit 02873fa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion zebra-grpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ use crate::scanner::{

type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;

/// The maximum number of messages that can be queued to be streamed to a client
/// from the `scan` method.
const SCAN_RESPONDER_BUFFER_SIZE: usize = 10_000;

#[derive(Debug)]
/// The server implementation
pub struct ScannerRPC<ScanService>
Expand Down Expand Up @@ -109,7 +113,8 @@ where
));
};

let (response_sender, response_receiver) = tokio::sync::mpsc::channel(10_000);
let (response_sender, response_receiver) =
tokio::sync::mpsc::channel(SCAN_RESPONDER_BUFFER_SIZE);
let response_stream = ReceiverStream::new(response_receiver);

tokio::spawn(async move {
Expand Down

0 comments on commit 02873fa

Please sign in to comment.