[gnome-software] Fix the growth in RSS for every search request
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Fix the growth in RSS for every search request
- Date: Fri, 11 Nov 2016 19:29:49 +0000 (UTC)
commit 473ee2561e1a403e8309253163213008f86485ae
Author: Richard Hughes <richard hughsie com>
Date: Thu Nov 10 18:11:14 2016 +0000
Fix the growth in RSS for every search request
We were creating a new addon for each request, rather than using the cache.
src/plugins/gs-appstream.c | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index 32a8c0f..075a5b6 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -120,8 +120,11 @@ gs_refine_item_icon (GsPlugin *plugin, GsApp *app, AsApp *item)
gs_app_add_icon (app, icon);
}
-static void
-gs_appstream_refine_add_addons (GsPlugin *plugin, GsApp *app, AsApp *item)
+static gboolean
+gs_appstream_refine_add_addons (GsPlugin *plugin,
+ GsApp *app,
+ AsApp *item,
+ GError **error)
{
GPtrArray *addons;
guint i;
@@ -129,7 +132,7 @@ gs_appstream_refine_add_addons (GsPlugin *plugin, GsApp *app, AsApp *item)
/* we only care about addons to desktop apps */
if (gs_app_get_kind (app) != AS_APP_KIND_DESKTOP)
- return;
+ return TRUE;
/* search categories for the search term */
ptask = as_profile_start (gs_plugin_get_profile (plugin),
@@ -139,22 +142,22 @@ gs_appstream_refine_add_addons (GsPlugin *plugin, GsApp *app, AsApp *item)
addons = as_app_get_addons (item);
if (addons == NULL)
- return;
+ return TRUE;
for (i = 0; i < addons->len; i++) {
AsApp *as_addon = g_ptr_array_index (addons, i);
- g_autoptr(GError) error = NULL;
g_autoptr(GsApp) addon = NULL;
- addon = gs_app_new (as_app_get_id (as_addon));
+ addon = gs_appstream_create_app (plugin, as_addon, error);
+ if (addon == NULL)
+ return FALSE;
/* add all the data we can */
- if (!gs_appstream_refine_app (plugin, addon, as_addon, &error)) {
- g_warning ("failed to refine addon: %s", error->message);
- continue;
- }
+ if (!gs_appstream_refine_app (plugin, addon, as_addon, error))
+ return FALSE;
gs_app_add_addon (app, addon);
}
+ return TRUE;
}
static void
@@ -709,7 +712,8 @@ gs_appstream_refine_app (GsPlugin *plugin,
gs_app_set_sources (app, pkgnames);
/* set addons */
- gs_appstream_refine_add_addons (plugin, app, item);
+ if (!gs_appstream_refine_add_addons (plugin, app, item, error))
+ return FALSE;
/* set screenshots */
gs_appstream_refine_add_screenshots (app, item);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]