dir: Fix caching of summary files

Cache hits didn’t result in the cache entry’s timeout being extended,
and timeouts didn’t result in the entry being removed from the cache to
free up resources (even though it would never be returned as a cache hit
again).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall
2020-08-21 17:11:45 +01:00
committed by Alexander Larsson
parent 9bec865995
commit 63b4f3a5c1

View File

@@ -10606,6 +10606,15 @@ flatpak_dir_lookup_cached_summary (FlatpakDir *self,
*bytes_sig_out = NULL;
}
res = TRUE;
/* Bump the cache expiry time */
summary->time = now;
}
else
{
/* Timed out or URL has changed; remove the entry */
g_hash_table_remove (self->summary_cache, name);
res = FALSE;
}
}