[gnome-software: 2/9] Always add apps that are to be installed to the install queue




commit d3e47d65716ea52530c44081a7f185c15cec2782
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Wed Jun 20 16:59:13 2018 +0200

    Always add apps that are to be installed to the install queue
    
    If there are apps being installed that have been queued because the
    plugin loader reached the maximum number of workers in its internal
    pool, then apps would still be effectively queued for installation
    but not added to the pending apps list. This meant that those queued
    apps would never show up in the installed page.
    
    This patch always adds apps to the installation queue when they're
    asked to be installed. This has the side effect that if GNOME Software
    is quit before the installations succeed, then the pending apps list
    is reloaded in the next start up and the apps are installed again.
    I believe this behavior is actually desired so I haven't prevented it.
    
    Update the unit tests to keep them working.
    
    (Rebased from downstream Endless OS by Philip Withnall)

 lib/gs-plugin-loader.c       | 3 +++
 plugins/dummy/gs-self-test.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 0bb2716fa..d25f52d40 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -3815,6 +3815,9 @@ gs_plugin_loader_schedule_task (GsPluginLoader *plugin_loader,
                /* set the pending-action to the app */
                GsPluginAction action = gs_plugin_job_get_action (helper->plugin_job);
                gs_app_set_pending_action (app, action);
+
+               if (action == GS_PLUGIN_ACTION_INSTALL)
+                       add_app_to_install_queue (plugin_loader, app);
        }
        g_thread_pool_push (plugin_loader->queued_ops_pool, g_object_ref (task), NULL);
 }
diff --git a/plugins/dummy/gs-self-test.c b/plugins/dummy/gs-self-test.c
index e15a9815e..a9dc3d620 100644
--- a/plugins/dummy/gs-self-test.c
+++ b/plugins/dummy/gs-self-test.c
@@ -724,7 +724,7 @@ gs_plugins_dummy_limit_parallel_ops_func (GsPluginLoader *plugin_loader)
 
        /* since we have only 1 parallel installation op possible,
         * verify the last operations are pending */
-       g_assert_cmpint (gs_app_get_state (app2), ==, GS_APP_STATE_AVAILABLE);
+       g_assert_cmpint (gs_app_get_state (app2), ==, GS_APP_STATE_QUEUED_FOR_INSTALL);
        g_assert_cmpint (gs_app_get_pending_action (app2), ==, GS_PLUGIN_ACTION_INSTALL);
        g_assert_cmpint (gs_app_get_state (app3), ==, GS_APP_STATE_UPDATABLE_LIVE);
        g_assert_cmpint (gs_app_get_pending_action (app3), ==, GS_PLUGIN_ACTION_UPDATE);


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