mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
udp: improve code in PendingScrapeResponseSlab.clean
This commit is contained in:
parent
9479828b4a
commit
6cbfa46805
1 changed files with 7 additions and 6 deletions
|
|
@ -110,18 +110,19 @@ impl PendingScrapeResponseSlab {
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
self.0.retain(|k, v| {
|
self.0.retain(|k, v| {
|
||||||
let keep = v.valid_until.0 > now;
|
if v.valid_until.0 > now {
|
||||||
|
true
|
||||||
if !keep {
|
} else {
|
||||||
::log::warn!(
|
::log::warn!(
|
||||||
"Removing PendingScrapeResponseSlab entry while cleaning. {:?}: {:?}",
|
"Unconsumed PendingScrapeResponseSlab entry. {:?}: {:?}",
|
||||||
k,
|
k,
|
||||||
v
|
v
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
keep
|
false
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.0.shrink_to_fit();
|
self.0.shrink_to_fit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue