fix oldest samples not being removed

This commit is contained in:
Ondrej Novak 2026-06-25 23:22:18 +02:00
parent d22e5659fc
commit 39074c3c0b
Signed by: handy
SSH Key Fingerprint: SHA256:jlNm8ijkaMl4X7+nn3zBFTJufdQgT4unKJoZVH6kYTM
1 changed files with 3 additions and 2 deletions

View File

@ -12,10 +12,11 @@ impl Container {
} }
pub fn push(&mut self, data: Vec<f32>) { pub fn push(&mut self, data: Vec<f32>) {
self.data.push(data);
if self.data.len() as u32 > self.max_samples { if self.data.len() as u32 > self.max_samples {
self.data.pop(); self.data.remove(0);
} }
self.data.push(data)
} }
pub fn iter(&self) -> std::slice::Iter<'_, Vec<f32>> { pub fn iter(&self) -> std::slice::Iter<'_, Vec<f32>> {