Skip to content

Commit cb3803e

Browse files
committed
configurable channel capacity
1 parent efb3f8b commit cb3803e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lazer/sdk/rust/client/examples/subscribe_price_feeds.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ async fn main() -> anyhow::Result<()> {
4545
.build(),
4646
)?;
4747

48-
let stream = client.start().await?;
48+
let stream = client
49+
.start(
50+
1000, // Use a channel capacity of 1000
51+
)
52+
.await?;
4953
pin!(stream);
5054

5155
let subscription_requests = vec![

lazer/sdk/rust/client/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ impl PythLazerClient {
5555
})
5656
}
5757

58-
pub async fn start(&mut self) -> Result<mpsc::Receiver<AnyResponse>> {
59-
let (sender, receiver) = mpsc::channel::<AnyResponse>(CHANNEL_CAPACITY);
58+
pub async fn start(&mut self, channel_capacity: usize) -> Result<mpsc::Receiver<AnyResponse>> {
59+
let (sender, receiver) = mpsc::channel::<AnyResponse>(channel_capacity);
6060

6161
for i in 0..self.num_connections {
6262
let endpoint = self.endpoints[i % self.endpoints.len()].clone();

0 commit comments

Comments
 (0)