Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r23314: LJSUP-13968 (Repost works incorrect in t...

Committer: ailyin
LJSUP-13968 (Repost works incorrect in the friendsfeed)
U   trunk/cgi-bin/LJ/Entry/Repost.pm
Modified: trunk/cgi-bin/LJ/Entry/Repost.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry/Repost.pm	2012-11-15 12:07:27 UTC (rev 23313)
+++ trunk/cgi-bin/LJ/Entry/Repost.pm	2012-11-15 12:17:49 UTC (rev 23314)
@@ -14,6 +14,9 @@
                REPOST_USERS_LIST_LIMIT => 25,
              };
 
+# memcache namespace: reposters chunks are stored with these keys in memcache
+my $memcache_ns = 'reposters_list_chunk2';
+
 sub __get_count {
     my ($u, $jitemid) = @_;
 
@@ -113,14 +116,14 @@
     # remove last users list block from cache
     # 
     my $last_block_id = int( $current_count / REPOST_USERS_LIST_LIMIT );    
-    LJ::MemCache::delete("reposters_list_chunk:$journalid:$jitemid:$last_block_id");
+    LJ::MemCache::delete("$memcache_ns:$journalid:$jitemid:$last_block_id");
     
     #
     # remove prev block too
     #
     if ($last_block_id > 0) {
         $last_block_id--;
-        LJ::MemCache::delete("reposters_list_chunk:$journalid:$jitemid:$last_block_id")
+        LJ::MemCache::delete("$memcache_ns:$journalid:$jitemid:$last_block_id")
     }
     
     #
@@ -394,7 +397,7 @@
  
     # construct memcache keys base
     my $journalid = $u->userid;
-    my $key_base = "reposters_list_chunk:$journalid:$jitemid";
+    my $key_base = "$memcache_ns:$journalid:$jitemid";
 
     # clean all blocks
     for (my $i = 0; $i < $blocks_count; $i++) {
@@ -406,7 +409,7 @@
     my ($journalid, $jitemid, $data, $lastrequest) = @_;
 
     my $subkey       = "$journalid:$jitemid";
-    my $memcache_key = "reposters_list_chunk:$subkey:$lastrequest";
+    my $memcache_key = "$memcache_ns:$subkey:$lastrequest";
     
     my $serialized = LJ::JSON->to_json( $data );
     LJ::MemCache::set( $memcache_key, $serialized, REPOST_KEYS_EXPIRING );
@@ -415,7 +418,7 @@
 sub __get_reposters_list {
     my ($journalid, $jitemid, $lastrequest) = @_;
 
-    my $memcache_key = "reposters_list_chunk:$journalid:$jitemid:$lastrequest";
+    my $memcache_key = "$memcache_ns:$journalid:$jitemid:$lastrequest";
 
     my $data;
     my $reposters = LJ::MemCache::get($memcache_key);
@@ -514,7 +517,11 @@
 
     foreach my $reposter (@$repostersids) {
         my $u = LJ::want_user($reposter);
-        push @$users, { user => $u->user,  'url' => $u->journal_base, };
+        push @$users, {
+            'userid' => $u->userid,
+            'user'   => $u->user,
+            'url'    => $u->journal_base,
+        };
     }  
  
     $reposters_info->{'last'}   = $lastrequest + 1;

Tags: ailyin, andy, livejournal, pm
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