[gnome-software] appstream: Prime the token cache when the loading screen is showing



commit 0dd775f14f1d969e68aa73605d17e24094614342
Author: Richard Hughes <richard hughsie com>
Date:   Mon May 22 11:50:20 2017 +0100

    appstream: Prime the token cache when the loading screen is showing
    
    Even on my fast machine the token cache prime takes ~0.7 seconds and thus
    triggers the warning.

 plugins/core/gs-plugin-appstream.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 843d38a..9cfc790 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -326,9 +326,6 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                }
        }
 
-       /* ensure the token cache */
-       as_store_load_search_cache (priv->store);
-
        /* rely on the store keeping itself updated */
        return TRUE;
 }
@@ -708,6 +705,10 @@ gs_plugin_refresh (GsPlugin *plugin,
        GsPluginData *priv = gs_plugin_get_data (plugin);
        g_auto(GStrv) appstream_urls = NULL;
 
+       /* ensure the token cache */
+       if (cache_age == G_MAXUINT)
+               as_store_load_search_cache (priv->store);
+
        if ((flags & GS_PLUGIN_REFRESH_FLAGS_METADATA) == 0)
                return TRUE;
 


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