udp: improve code in PendingScrapeResponseSlab.clean

This commit is contained in:
Joakim Frostegård 2022-04-14 17:29:56 +02:00
parent 9479828b4a
commit 6cbfa46805

View file

@ -110,18 +110,19 @@ impl PendingScrapeResponseSlab {
let now = Instant::now();
self.0.retain(|k, v| {
let keep = v.valid_until.0 > now;
if !keep {
if v.valid_until.0 > now {
true
} else {
::log::warn!(
"Removing PendingScrapeResponseSlab entry while cleaning. {:?}: {:?}",
"Unconsumed PendingScrapeResponseSlab entry. {:?}: {:?}",
k,
v
);
}
keep
false
}
});
self.0.shrink_to_fit();
}
}