From 3b1b677b49af194313da766579e9fa1a021afd84 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 1 Dec 2013 23:15:30 -0600 Subject: Speed up master key listing page We were spending a lot of time getting the developer name for a given key on this page, which involved sending one query per key ID. Use the cache to our advantage here and save ourselves the "expensive" lookups. This eliminates ~100 queries per page load. Signed-off-by: Dan McGee --- templates/public/keys.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'templates/public') diff --git a/templates/public/keys.html b/templates/public/keys.html index c7272db3..54d52ab8 100644 --- a/templates/public/keys.html +++ b/templates/public/keys.html @@ -86,16 +86,16 @@ - {% for user in active_users %} + {% for user in active_users %}{% with user_key=user.userprofile.pgp_key %} {{ user.get_full_name }} - {% pgp_key_link user.userprofile.pgp_key %} + {% pgp_key_link user_key %} {% spaceless %}{% for key in keys %} - {% signature_exists signatures key.pgp_key user.userprofile.pgp_key as signed %} + {% signature_exists signatures key.pgp_key user_key as signed %} {{ signed|yesno|capfirst }} {% endfor %}{% endspaceless %} - {% endfor %} + {% endwith %}{% endfor %} -- cgit v1.2.3-2-g168b From 0b0e2b9d2aabd1c34f742e6525ee075751600e37 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 14 Dec 2013 15:06:26 -0600 Subject: Fix some caching issues on the front page The return value from get_recent_updates() was too big for memcached due to all the attached objects, so the cache never actually worked. This sucks, because we ended up doing all the work in this function and most of the time we didn't use it because template fragment caching kicked in. Remove the cache_function decorator from this method, and instead implement delayed calling of the function so we don't compute values we aren't going to use. Template fragment caching will help us in most cases. Signed-off-by: Dan McGee --- templates/public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/public') diff --git a/templates/public/index.html b/templates/public/index.html index c5924ab7..58dd3729 100644 --- a/templates/public/index.html +++ b/templates/public/index.html @@ -105,7 +105,7 @@ {% endcache %} -{% cache 59 main-page-right secure %} +{% cache 115 main-page-right secure %}