fix: use elapsed() instead of inverted duration_since check

The cache retry logic had last_check.duration_since(Instant::now()) which
is backwards - duration_since computes self - earlier, so past.duration_since(future)
always returns Duration::ZERO (saturates to 0). This caused icons marked NotFound
to never be retried, breaking the intended 5-second retry window.

Using last_check.elapsed() is equivalent to Instant::now().duration_since(last_check)
and correctly measures how much time has passed since the cache entry was created.
This commit is contained in:
Blaž Čulina 2026-04-14 15:04:38 +02:00 committed by Michael Murphy
parent 7a61a704f6
commit 9c562fe3ec

View file

@ -256,9 +256,7 @@ impl<'a> LookupBuilder<'a> {
if self.cache {
match self.cache_lookup(self.theme) {
CacheEntry::Found(icon) => return Some(icon),
CacheEntry::NotFound(last_check)
if last_check.duration_since(Instant::now()).as_secs() < 5 =>
{
CacheEntry::NotFound(last_check) if last_check.elapsed().as_secs() < 5 => {
return None;
}
_ => (),