[gnome-software/wip/mcrha/plugin-loader-self-test: 23/24] gs-odrs-provider: Create a GsApp instance in refresh only when needed
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/mcrha/plugin-loader-self-test: 23/24] gs-odrs-provider: Create a GsApp instance in refresh only when needed
- Date: Mon, 11 Oct 2021 11:59:15 +0000 (UTC)
commit 63bcc4066b2f99ce22c607cbdb16efae249e4e71
Author: Milan Crha <mcrha redhat com>
Date: Wed Oct 6 15:39:53 2021 +0200
gs-odrs-provider: Create a GsApp instance in refresh only when needed
There can be cases where the GsApp instance is created, but not used,
thus create it only if really needed.
lib/gs-odrs-provider.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/lib/gs-odrs-provider.c b/lib/gs-odrs-provider.c
index a7e30a746..00502e27c 100644
--- a/lib/gs-odrs-provider.c
+++ b/lib/gs-odrs-provider.c
@@ -1236,7 +1236,7 @@ gs_odrs_provider_refresh (GsOdrsProvider *self,
g_autofree gchar *cache_filename = NULL;
g_autofree gchar *uri = NULL;
g_autoptr(GError) error_local = NULL;
- g_autoptr(GsApp) app_dl = gs_app_new ("odrs");
+ g_autoptr(GsApp) app_dl = NULL;
/* check cache age */
cache_filename = gs_utils_get_cache_filename ("odrs",
@@ -1258,6 +1258,8 @@ gs_odrs_provider_refresh (GsOdrsProvider *self,
}
}
+ app_dl = gs_app_new ("odrs");
+
/* download the complete file */
uri = g_strdup_printf ("%s/ratings", self->review_server);
g_debug ("Updating ODRS cache from %s to %s", uri, cache_filename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]