madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r22887: LJSUP-13445: Home page optimization: sta...

Committer: sbelyaev
LJSUP-13445: Home page optimization: stage 2
U   trunk/cgi-bin/LJ/Widget/RecentComments.pm
Modified: trunk/cgi-bin/LJ/Widget/RecentComments.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/RecentComments.pm	2012-09-13 12:36:35 UTC (rev 22886)
+++ trunk/cgi-bin/LJ/Widget/RecentComments.pm	2012-09-13 12:39:32 UTC (rev 22887)
@@ -41,16 +41,6 @@
 
     my @comments = $u->get_recent_talkitems($limit, memcache => 1);
 
-    my $key_part = crc32(join(':', map { $_->{jtalkid} } @comments));
-    my $key = "recent_comments_widget:$key_part:" . 
-              ":" . $lncode .
-              ":" . $u->userid;
-
-    my $data = LJ::MemCache::get($key);
-    if ($data) {
-        return $data;
-    }
-
     my $ret;
 
     $ret .= "<div class='w-head'>";
@@ -62,6 +52,16 @@
     return "<h2><span>" . $class->ml('widget.recentcomments.title') . "</span></h2><div class='warningbar'>" . $class->ml('widget.recentcomments.nocomments', {'aopts' => "href='$LJ::SITEROOT/update.bml'"}) . "</div>"
         unless @comments && defined $comments[0];
 
+    my $key_part = crc32(join(':', map { $_->{jtalkid} } @comments));
+    my $key = "recent_comments_widget:$key_part:" .
+              ":" . $lncode .
+              ":" . $u->userid;
+
+    my $data = LJ::MemCache::get($key);
+    if ($data) {
+        return $data;
+    }
+
     # there are comments, print them
     @comments = reverse @comments; # reverse the comments so newest is printed first
     $ret .= "<div class='w-body'>";

Tags: livejournal, madeon, pm, sbelyaev
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments