Skip to content

Commit

Permalink
Added MAX_DATA_LEN
Browse files Browse the repository at this point in the history
  • Loading branch information
amigin committed Jul 11, 2022
1 parent 7722180 commit 98cbc7d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/data_readers/tcp_connection/send_per_second.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use std::collections::VecDeque;

use tokio::sync::Mutex;

const MAX_DATA_LEN: usize = 120;

pub struct SendPerSecond {
data: Mutex<VecDeque<usize>>,
}
Expand All @@ -17,7 +19,7 @@ impl SendPerSecond {
let mut write_access = self.data.lock().await;
write_access.push_back(value);

while write_access.len() > 160 {
while write_access.len() > MAX_DATA_LEN {
write_access.pop_front();
}
}
Expand Down

0 comments on commit 98cbc7d

Please sign in to comment.