[gnome-software/1712-clicking-fedora-flathub-selection-does-not-update-the-filtered-flathub-appstream-metadata: 3/5] flatpak: Always drop internal caches for both installation instances




commit dc1ee700da25a18f74e3902372228ee8136f75eb
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 14 14:25:19 2022 +0200

    flatpak: Always drop internal caches for both installation instances
    
    When a refresh is requested, always drop internal flatpak caches
    for both FlatpakInstallation instances, to ensure they both agree
    on the local cache content. Otherwise the other FlatpakInstallation
    uses stale data and can error out on calls when being used.
    
    An example: the refresh can be called with interactive, but search
    with non-interactive, then the search can fail to refine metainfo
    data with error "No such ref", because its internal flatpak cache
    was not updated.

 plugins/flatpak/gs-flatpak.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 50ffa5583..df81ea90d 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1968,8 +1968,16 @@ gs_flatpak_refresh (GsFlatpak *self,
        g_hash_table_remove_all (self->broken_remotes);
        g_mutex_unlock (&self->broken_remotes_mutex);
 
-       /* manually drop the cache */
-       if (!flatpak_installation_drop_caches (gs_flatpak_get_installation (self, interactive),
+       /* manually drop the cache in both installation instances;
+        * it's needed to have them both agree on the content. */
+       if (!flatpak_installation_drop_caches (gs_flatpak_get_installation (self, FALSE),
+                                              cancellable,
+                                              error)) {
+               gs_flatpak_error_convert (error);
+               return FALSE;
+       }
+
+       if (!flatpak_installation_drop_caches (gs_flatpak_get_installation (self, TRUE),
                                               cancellable,
                                               error)) {
                gs_flatpak_error_convert (error);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]