From 63b4f3a5c16b73426b65f24b804eee0f16d4bead 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 --- common/flatpak-dir.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index d47075bf..2a1cb4f7 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -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; } }