[gnome-software/1712-clicking-fedora-flathub-selection-does-not-update-the-filtered-flathub-appstream-metadata: 2/5] flatpak: Invalidate caches when app data rescan fails
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1712-clicking-fedora-flathub-selection-does-not-update-the-filtered-flathub-appstream-metadata: 2/5] flatpak: Invalidate caches when app data rescan fails
- Date: Wed, 20 Apr 2022 14:02:59 +0000 (UTC)
commit 08959d8351cde4173745e21cf3ca4a365764fd71
Author: Milan Crha <mcrha redhat com>
Date: Thu Apr 14 14:29:30 2022 +0200
flatpak: Invalidate caches when app data rescan fails
Otherwise the gnome-software caches may not reflect actual state of
the flatpak data, pretending everything is up-to-date even it's not.
This could happen for example when enabling a flatpak remote
in the Repositories dialog and closing the dialog early, which
cancels the operation, maybe in the middle of downloading appstream
data from the server.
plugins/flatpak/gs-flatpak.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 91d6540c2..50ffa5583 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -447,11 +447,9 @@ gs_flatpak_create_source (GsFlatpak *self, FlatpakRemote *xremote)
return g_steal_pointer (&app);
}
-static gboolean
-gs_flatpak_claim_changed_idle_cb (gpointer user_data)
+static void
+gs_flatpak_internal_data_changed (GsFlatpak *self)
{
- GsFlatpak *self = user_data;
- g_autoptr(GError) error = NULL;
g_autoptr(GMutexLocker) locker = NULL;
g_autoptr(GRWLockWriterLocker) writer_locker = NULL;
@@ -476,7 +474,14 @@ gs_flatpak_claim_changed_idle_cb (gpointer user_data)
g_clear_pointer (&writer_locker, g_rw_lock_writer_locker_free);
self->requires_full_rescan = TRUE;
+}
+static gboolean
+gs_flatpak_claim_changed_idle_cb (gpointer user_data)
+{
+ GsFlatpak *self = user_data;
+
+ gs_flatpak_internal_data_changed (self);
gs_plugin_cache_invalidate (self->plugin);
gs_plugin_reload (self->plugin);
@@ -1086,10 +1091,17 @@ gs_flatpak_rescan_app_data (GsFlatpak *self,
gboolean res = gs_flatpak_refresh (self, 0, interactive, cancellable, error);
if (res)
self->requires_full_rescan = FALSE;
+ else
+ gs_flatpak_internal_data_changed (self);
return res;
}
- return gs_flatpak_rescan_appstream_store (self, interactive, cancellable, error);
+ if (!gs_flatpak_rescan_appstream_store (self, interactive, cancellable, error)) {
+ gs_flatpak_internal_data_changed (self);
+ return FALSE;
+ }
+
+ return TRUE;
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]