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(); 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();
} }
} }