[gnome-software: 2/7] flatpak: Block on download scheduler for updates




commit cf9b2dfa45fcb695856bdaf036b31c8099d00fae
Author: Philip Withnall <withnall endlessm com>
Date:   Fri May 22 19:25:45 2020 +0100

    flatpak: Block on download scheduler for updates
    
    Previously, the code assumed that the `download` job would always run
    before `update`, but that might not actually be the case (which is
    presumably why `flatpak_transaction_set_no_pull()` is only called
    conditionally).
    
    Block on the download scheduler if the update needs at least one
    download.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 plugins/flatpak/gs-plugin-flatpak.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index fd862b80..9c84f84b 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -993,8 +993,17 @@ gs_plugin_flatpak_update (GsPlugin *plugin,
                is_update_downloaded &= gs_app_get_is_update_downloaded (app);
        }
 
-       if (is_update_downloaded)
+       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, 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)
        /* automatically clean up unused EOL runtimes when updating */


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