mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2024-11-21 15:57:24 -06:00
Add explicit cleanup to the queue tracker to remove any queues that were once seen but have gone
This commit is contained in:
parent
3db42b1845
commit
ea80139311
@ -63,8 +63,11 @@ impl AllQueueData {
|
||||
q.marks = DownUpOrder::zeroed();
|
||||
}
|
||||
|
||||
let mut seen_queue_ids = Vec::new();
|
||||
|
||||
// Make download markings
|
||||
for dl in download.into_iter() {
|
||||
seen_queue_ids.push(dl.circuit_id.clone());
|
||||
if let Some(q) = lock.get_mut(&dl.circuit_id) {
|
||||
// We need to update it
|
||||
q.drops.down = dl.drops;
|
||||
@ -85,6 +88,7 @@ impl AllQueueData {
|
||||
|
||||
// Make upload markings
|
||||
for ul in upload.into_iter() {
|
||||
seen_queue_ids.push(ul.circuit_id.clone());
|
||||
if let Some(q) = lock.get_mut(&ul.circuit_id) {
|
||||
// We need to update it
|
||||
q.drops.up = ul.drops;
|
||||
@ -102,6 +106,9 @@ impl AllQueueData {
|
||||
lock.insert(ul.circuit_id.clone(), new_record);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any queues that were not seen
|
||||
lock.retain(|k, _| seen_queue_ids.contains(k));
|
||||
}
|
||||
|
||||
pub fn iterate_queues(&self, mut f: impl FnMut(&str, &DownUpOrder<u64>, &DownUpOrder<u64>)) {
|
||||
|
Loading…
Reference in New Issue
Block a user