Skip to content

Commit 7e69bb1

Browse files
committed
move to stack based vector for websocket_depth_buffer in exchange stream
1 parent 2a1b2bd commit 7e69bb1

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Cargo.lock

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exchange/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ tracing.workspace = true
2020
itertools.workspace = true
2121
tokio-tungstenite.workspace = true
2222
pin-project-lite.workspace = true
23+
arrayvec = { git = "https://github.com/bluss/arrayvec" }
24+

exchange/src/stream.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use arrayvec::ArrayVec;
12
use std::error::Error;
23
use std::{pin::Pin, task::Poll};
34

@@ -34,7 +35,8 @@ pin_project! {
3435
pub client_name: String,
3536
pub exchange_name: u8,
3637
pub snapshot_enabled: bool,
37-
pub websocket_depth_buffer: Vec<DepthUpdate>,
38+
// todo: update webssocket_depth_buffer take the array vecs size by pragma or something similar -- it should be configurable
39+
pub websocket_depth_buffer: ArrayVec<DepthUpdate, 1000>,
3840
pub pull_retry_count: u8,
3941
pub http_snapshot_uri: String,
4042
pub buffer_websocket_depths: bool,

0 commit comments

Comments
 (0)