From 9c562fe3ecf03241a46a60c0078cd6ea10bd75ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20=C4=8Culina?= Date: Tue, 14 Apr 2026 15:04:38 +0200 Subject: [PATCH] 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. --- src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 82ea750..bda47dd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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; } _ => (),