[gnome-software/gnome-3-20] Set a reasonable cache age for system upgrades
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-20] Set a reasonable cache age for system upgrades
- Date: Mon, 11 Jul 2016 10:23:40 +0000 (UTC)
commit 9b3ac42f30a3dae06a2b17d29fd02d088c09a383
Author: Kalev Lember <klember redhat com>
Date: Mon Jul 11 11:45:07 2016 +0200
Set a reasonable cache age for system upgrades
Previously we would use G_MAXUINT for all system upgrade operations
which means to never refresh any metadata once we have _anything_
downloaded. This broke pretty horribly because Fedora tends to put out
new metadata every day together with deleting old rpms from mirrors.
Instead, this changes it so that for background cache operations we
download new system upgrade metadata every week, and once the user
interactively clicks "Download" we download it again if it's older than
a day.
This should ensure that we have metadata that has a chance of working
and referencing rpms that are actually available on mirrors.
src/plugins/gs-plugin-packagekit-refine.c | 5 +++++
src/plugins/gs-plugin-packagekit-upgrade.c | 2 +-
2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 0d8bc10..2ac9d9a 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -779,6 +779,7 @@ gs_plugin_packagekit_refine_distro_upgrade (GsPlugin *plugin,
ProgressData data;
g_autoptr(PkResults) results = NULL;
g_autoptr(GsAppList) list = NULL;
+ guint cache_age_save;
data.app = app;
data.plugin = plugin;
@@ -786,6 +787,8 @@ gs_plugin_packagekit_refine_distro_upgrade (GsPlugin *plugin,
data.profile_id = NULL;
/* ask PK to simulate upgrading the system */
+ cache_age_save = pk_client_get_cache_age (plugin->priv->client);
+ pk_client_set_cache_age (plugin->priv->client, 60 * 60 * 24 * 7); /* once per week */
results = pk_client_upgrade_system (plugin->priv->client,
pk_bitfield_from_enums (PK_TRANSACTION_FLAG_ENUM_SIMULATE, -1),
gs_app_get_version (app),
@@ -793,6 +796,8 @@ gs_plugin_packagekit_refine_distro_upgrade (GsPlugin *plugin,
cancellable,
gs_plugin_packagekit_progress_cb, &data,
error);
+ pk_client_set_cache_age (plugin->priv->client, cache_age_save);
+
if (!gs_plugin_packagekit_results_valid (results, error))
return FALSE;
if (!gs_plugin_packagekit_add_results (plugin, &list, results, error))
diff --git a/src/plugins/gs-plugin-packagekit-upgrade.c b/src/plugins/gs-plugin-packagekit-upgrade.c
index b3d1b5d..8ec3c1e 100644
--- a/src/plugins/gs-plugin-packagekit-upgrade.c
+++ b/src/plugins/gs-plugin-packagekit-upgrade.c
@@ -52,7 +52,7 @@ gs_plugin_initialize (GsPlugin *plugin)
plugin->priv->task = pk_task_new ();
pk_task_set_only_download (plugin->priv->task, TRUE);
pk_client_set_background (PK_CLIENT (plugin->priv->task), TRUE);
- pk_client_set_cache_age (PK_CLIENT (plugin->priv->task), G_MAXUINT);
+ pk_client_set_cache_age (PK_CLIENT (plugin->priv->task), 60 * 60 * 24);
pk_client_set_interactive (PK_CLIENT (plugin->priv->task), FALSE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]