[gnome-builder] flatpak: use flatpak_installation_list_remote_refs_sync()



commit 43bb57e3d1e0bab437d78de6ff6646413e1a9dea
Author: Christian Hergert <chergert redhat com>
Date:   Thu Nov 18 21:44:20 2021 -0800

    flatpak: use flatpak_installation_list_remote_refs_sync()
    
    Instead of calling flatpak_installation_update_remote_sync() at startup
    we need to use flatpak_installation_list_remote_refs_sync() to help ensure
    that we actually have refs that we can use when performing cache-only
    lookups from the UI process. Otherwise, things like IsKnown() will fail.
    That is a pretty bad look on a fresh install, so this will help with that.
    
    It would be nice if we could do a bit less network I/O here but we were
    already doing it so this at least fixes things.

 src/plugins/flatpak/daemon/ipc-flatpak-repo.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/flatpak/daemon/ipc-flatpak-repo.c b/src/plugins/flatpak/daemon/ipc-flatpak-repo.c
index a5a8d6f01..0b4fcab87 100644
--- a/src/plugins/flatpak/daemon/ipc-flatpak-repo.c
+++ b/src/plugins/flatpak/daemon/ipc-flatpak-repo.c
@@ -88,6 +88,7 @@ ipc_flatpak_repo_constructed (GObject *object)
   for (guint i = 0; i < G_N_ELEMENTS (remotes); i++)
     {
       g_autoptr(FlatpakRemote) remote = NULL;
+      g_autoptr(GPtrArray) refs = NULL;
 
       if (!(remote = flatpak_installation_get_remote_by_name (self->installation, remotes[i], NULL, NULL)))
         {
@@ -116,11 +117,12 @@ ipc_flatpak_repo_constructed (GObject *object)
         }
 
       g_debug ("Updating remote %s", remotes[i]);
-      if (!flatpak_installation_update_remote_sync (self->installation, remotes[i], NULL, &error))
-        {
-          g_warning ("Failed to update remote %s: %s", remotes[i], error->message);
-          g_clear_error (&error);
-        }
+      refs = flatpak_installation_list_remote_refs_sync (self->installation, remotes[i], NULL, &error);
+      if (error != NULL)
+        g_warning ("Failed to update remote %s: %s", remotes[i], error->message);
+      else
+        g_debug ("Found %u refs", refs->len);
+      g_clear_error (&error);
     }
 
 #define INSTALLATION_NAME "Installation \"gnome-builder-private\""


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