From 7a1c268405a6100b2ca78b9294df470d6845310d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 21 Aug 2020 17:11:45 +0100 Subject: [PATCH] dir: Fix caching of summary files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit 63b4f3a5c16b73426b65f24b804eee0f16d4bead) --- common/flatpak-dir.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index ae7fe842..ed1248e7 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -10605,6 +10605,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; } }