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:
parent
7a61a704f6
commit
9c562fe3ec
1 changed files with 1 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
_ => (),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue