mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2012-02-09 11:07 pm

[dw-free] Don't load your last comment over and over

[commit: http://hg.dwscoalition.org/dw-free/rev/c232f9606422]

Don't load your last comment over and over

This was being called for every comment. It doesn't change on a single page
load, so let's move it up so it loads once.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/LJ/S2/EntryPage.pm
--------------------------------------------------------------------------------
diff -r 09a36de1bac5 -r c232f9606422 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm	Thu Feb 09 19:54:37 2012 +0800
+++ b/cgi-bin/LJ/S2/EntryPage.pm	Thu Feb 09 23:09:34 2012 +0000
@@ -136,6 +136,8 @@
     }
 
     my $pics = LJ::Talk::get_subjecticons()->{'pic'};  # hashref of imgname => { w, h, img }
+    my ($last_talkid, $last_jid) = LJ::get_lastcomment();
+
     my $convert_comments = sub {
         my ($self, $destlist, $srclist, $depth) = @_;
 
@@ -234,7 +236,6 @@
             }
 
             # Comment Posted Notice
-            my ($last_talkid, $last_jid) = LJ::get_lastcomment();
             my $same_talkid = ( $last_talkid || 0 ) == ( $dtalkid || 0 );
             my $same_jid = ( $last_jid || 0 ) == ( $remote ? $remote->userid : 0 );
             my $commentposted = "";
--------------------------------------------------------------------------------