madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r23103: LJSUP-13883: Journal pages optimizaiton ...

Committer: sbelyaev
LJSUP-13883: Journal pages optimizaiton : stage 1
U   trunk/cgi-bin/LJ/S2.pm
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2012-10-11 10:44:57 UTC (rev 23102)
+++ trunk/cgi-bin/LJ/S2.pm	2012-10-11 10:46:05 UTC (rev 23103)
@@ -362,7 +362,7 @@
     # see what we can get out of memcache first
     my @keys;
     push @keys, [ $_, "s2lo:$_" ] foreach @lids;
-    my $memc = LJ::MemCache::get_multi(@keys);
+    my $memc = LJ::MemCacheProxy::get_multi(@keys);
     foreach my $lid (@lids) {
         if (my $uid = $memc->{"s2lo:$lid"}) {
             delete $need{$lid};
@@ -380,7 +380,7 @@
         foreach my $row (@$res) {
             # save info and add to memcache
             $ret->{$row->[0]} = $row->[1];
-            LJ::MemCache::add([ $row->[0], "s2lo:$row->[0]" ], $row->[1]);
+            LJ::MemCacheProxy::add([ $row->[0], "s2lo:$row->[0]" ], $row->[1]);
         }
     }
 
@@ -405,10 +405,13 @@
     my @from_db;   # lid, lid, lid, ...
     my @need_memc; # lid, lid, lid, ...
 
+    my $sysid = LJ::get_userid('system');
+    my $us_ls = LJ::S2::get_layer_owners(@lids);
     # initial sweep, anything loaded for less than 60 seconds is golden
     # if dev server, only cache layers for 1 second
     foreach my $lid (@lids) {
-        if (my $loaded = S2::layer_loaded($lid, $LJ::IS_DEV_SERVER ? 1 : 60)) {
+        my $tmo = $us_ls->{$lid}->{userid} == $sysid ? 3600 : 60;
+        if (my $loaded = S2::layer_loaded($lid, $LJ::IS_DEV_SERVER ? 1 : $tmo)) {
             # it's loaded and not more than 60 seconds load, so we just go
             # with it and assume it's good... if it's been recompiled, we'll
             # figure it out within the next 60 seconds
@@ -439,7 +442,6 @@
 
     # figure out who owns what we need
     my $us = LJ::S2::get_layer_owners(@from_db);
-    my $sysid = LJ::get_userid('system');
 
     # break it down by cluster
     my %bycluster; # cluster => [ lid, lid, ... ]

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