[gnome-software] Do not fail to get the updates if getting the history fails
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Do not fail to get the updates if getting the history fails
- Date: Wed, 23 Oct 2013 08:13:20 +0000 (UTC)
commit a3f8f6e4a4fd2085d35086db02a14aeef4251db0
Author: Richard Hughes <richard hughsie com>
Date: Wed Oct 23 09:10:41 2013 +0100
Do not fail to get the updates if getting the history fails
It takes 226ms to get the history of 849 packages, which is slightly above the
current timeout value. Increase this to something much larger, and additionally
do not fail the refine if the method takes longer than this. The history data is
supplemental afterall and not explicitly required.
src/plugins/gs-plugin-packagekit-history.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-history.c b/src/plugins/gs-plugin-packagekit-history.c
index bac3e0c..e67139c 100644
--- a/src/plugins/gs-plugin-packagekit-history.c
+++ b/src/plugins/gs-plugin-packagekit-history.c
@@ -26,6 +26,8 @@
#include <gs-plugin.h>
+#define GS_PLUGIN_PACKAGEKIT_HISTORY_TIMEOUT 5000 /* ms */
+
struct GsPluginPrivate {
gsize loaded;
GDBusConnection *connection;
@@ -186,7 +188,7 @@ gs_plugin_packagekit_refine (GsPlugin *plugin,
g_variant_new ("(^asu)", package_names, 0),
NULL,
G_DBUS_CALL_FLAGS_NONE,
- 200, /* 200ms should be more than enough... */
+ GS_PLUGIN_PACKAGEKIT_HISTORY_TIMEOUT,
cancellable,
&error_local);
if (result == NULL) {
@@ -203,6 +205,16 @@ gs_plugin_packagekit_refine (GsPlugin *plugin,
app = GS_APP (l->data);
gs_app_set_install_date (app, GS_APP_INSTALL_DATE_UNKNOWN);
}
+ } else if (g_error_matches (error_local,
+ G_IO_ERROR,
+ G_IO_ERROR_TIMED_OUT)) {
+ g_debug ("No history as PackageKit took too long: %s",
+ error_local->message);
+ g_error_free (error_local);
+ for (l = list; l != NULL; l = l->next) {
+ app = GS_APP (l->data);
+ gs_app_set_install_date (app, GS_APP_INSTALL_DATE_UNKNOWN);
+ }
} else {
ret = FALSE;
g_propagate_error (error, error_local);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]