[gnome-software/1712-clicking-fedora-flathub-selection-does-not-update-the-filtered-flathub-appstream-metadata: 5/5] flatpak: Properly react to cancellation of the rescan of appstream store




commit ce41b9efcec2dd6c6bf224b470c8d6c7166318f5
Author: Milan Crha <mcrha redhat com>
Date:   Wed Apr 20 15:59:56 2022 +0200

    flatpak: Properly react to cancellation of the rescan of appstream store
    
    While a load of an appstream store can fail and be ignored, the cancellation
    is a different kind of failure, as it can mean the appstream data not being
    read at all, thus rather return failure when the read is cancelled, to have
    the internal caches marked as invalid by the caller.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1712

 plugins/flatpak/gs-flatpak.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index a77230ab2..09d28add1 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1042,6 +1042,10 @@ gs_flatpak_rescan_appstream_store (GsFlatpak *self,
                if (!gs_flatpak_add_apps_from_xremote (self, builder, xremote, interactive, cancellable, 
&error_local)) {
                        g_debug ("Failed to add apps from remote ā€˜%sā€™; skipping: %s",
                                 flatpak_remote_get_name (xremote), error_local->message);
+                       if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
+                               gs_flatpak_error_convert (error);
+                               return FALSE;
+                       }
                }
        }
 
@@ -1069,7 +1073,7 @@ gs_flatpak_rescan_appstream_store (GsFlatpak *self,
        self->silo = xb_builder_ensure (builder, file,
                                        XB_BUILDER_COMPILE_FLAG_IGNORE_INVALID |
                                        XB_BUILDER_COMPILE_FLAG_SINGLE_LANG,
-                                       NULL, error);
+                                       cancellable, error);
 
        if (old_thread_default != NULL)
                g_main_context_push_thread_default (old_thread_default);


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