From cf2d5625efc9cbc6c903bd579ebb6e4a03c242d1 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Thu, 6 Dec 2012 10:52:32 -0800 Subject: [PATCH] CommentPane: try to avoid building comment tree if possible. --- r2/r2/lib/pages/pages.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 91ae053b6..b5a2082a5 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -1168,11 +1168,11 @@ class CommentPane(Templated): parent_name = article._fullname) return listing.listing() - # generate the listing we would make for this user if caching is disabled. - my_listing = renderer() - - # for now, disable the cache if the user happens to be an author of anything. + # disable the cache if the user is the author of anything in the + # thread because of edit buttons etc. + my_listing = None if try_cache and c.user_is_loggedin: + my_listing = renderer() for t in self.listing_iter(my_listing): if getattr(t, "is_author", False): try_cache = False @@ -1239,6 +1239,7 @@ class CommentPane(Templated): saves = saves).render() g.log.debug("using comment page cache") else: + my_listing = my_listing or renderer() self.rendered = my_listing.render() if try_cache: