[gnome-software: 6/7] flatpak: Shift Mogwai waits above where transactions are built




commit 87f85e2e6a7e580c9e9fb42d108a7e4f39aa1fdb
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Jan 18 17:20:54 2021 +0000

    flatpak: Shift Mogwai waits above where transactions are built
    
    This means that once the process has finished waiting for Mogwai, it
    builds the transaction, rather than building it and then waiting. This
    means the download/upgrade will use a potentially more up-to-date set of
    OSTree commit checksums.
    
    Suggested by Phaedrus Leeds.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 plugins/flatpak/gs-plugin-flatpak.c | 38 +++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index d81739cb..e3d7805e 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -663,6 +663,16 @@ gs_plugin_download (GsPlugin *plugin, GsAppList *list,
                g_assert (list_tmp != NULL);
                g_assert (gs_app_list_length (list_tmp) > 0);
 
+               if (!gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)) {
+                       g_autoptr(GError) error_local = NULL;
+
+                       if (!gs_metered_block_app_list_on_download_scheduler (list_tmp, 
&schedule_entry_handle, cancellable, &error_local)) {
+                               g_warning ("Failed to block on download scheduler: %s",
+                                          error_local->message);
+                               g_clear_error (&error_local);
+                       }
+               }
+
                /* build and run non-deployed transaction */
                transaction = _build_transaction (plugin, flatpak, cancellable, error);
                if (transaction == NULL) {
@@ -702,16 +712,6 @@ gs_plugin_download (GsPlugin *plugin, GsAppList *list,
                        }
                }
 
-               if (!gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)) {
-                       g_autoptr(GError) error_local = NULL;
-
-                       if (!gs_metered_block_app_list_on_download_scheduler (list_tmp, 
&schedule_entry_handle, cancellable, &error_local)) {
-                               g_warning ("Failed to block on download scheduler: %s",
-                                          error_local->message);
-                               g_clear_error (&error_local);
-                       }
-               }
-
                if (!gs_flatpak_transaction_run (transaction, cancellable, error)) {
                        gs_flatpak_error_convert (error);
                        remove_schedule_entry (schedule_entry_handle);
@@ -960,6 +960,16 @@ gs_plugin_flatpak_update (GsPlugin *plugin,
        gboolean is_update_downloaded = TRUE;
        gpointer schedule_entry_handle = NULL;
 
+       if (!gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)) {
+               g_autoptr(GError) error_local = NULL;
+
+               if (!gs_metered_block_app_list_on_download_scheduler (list_tmp, &schedule_entry_handle, 
cancellable, &error_local)) {
+                       g_warning ("Failed to block on download scheduler: %s",
+                                  error_local->message);
+                       g_clear_error (&error_local);
+               }
+       }
+
        /* build and run transaction */
        transaction = _build_transaction (plugin, flatpak, cancellable, error);
        if (transaction == NULL) {
@@ -1013,14 +1023,6 @@ gs_plugin_flatpak_update (GsPlugin *plugin,
 
        if (is_update_downloaded) {
                flatpak_transaction_set_no_pull (transaction, TRUE);
-       } else if (!gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)) {
-               g_autoptr(GError) error_local = NULL;
-
-               if (!gs_metered_block_app_list_on_download_scheduler (list_tmp, &schedule_entry_handle, 
cancellable, &error_local)) {
-                       g_warning ("Failed to block on download scheduler: %s",
-                                  error_local->message);
-                       g_clear_error (&error_local);
-               }
        }
 
 #if FLATPAK_CHECK_VERSION(1, 9, 1)


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