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] changelog2009-04-01 05:41 am

[dw-free] lag in profile update when joining/leaving comms

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

http://bugs.dwscoalition.org/show_bug.cgi?id=452

Fix clearing of memcache key for reltarget.

Patch by [personal profile] janinedog.

Files modified:
  • cgi-bin/DW/User/Edges/CommMembership.pm
  • cgi-bin/ljrelation.pl
--------------------------------------------------------------------------------
diff -r 59629336ae7a -r 65c6557a1e98 cgi-bin/DW/User/Edges/CommMembership.pm
--- a/cgi-bin/DW/User/Edges/CommMembership.pm	Wed Apr 01 04:58:44 2009 +0000
+++ b/cgi-bin/DW/User/Edges/CommMembership.pm	Wed Apr 01 05:41:11 2009 +0000
@@ -96,9 +96,6 @@ sub member_of {
 
 
 # returns array of userids we're member of
-# you may specify one argument "force => 1" if you are unwilling to take
-# potentially stale data.  otherwise, the results of this method may be up to
-# 30 minutes out of date.
 sub member_of_userids {
     my ( $u, %args ) = @_;
     $u = LJ::want_user( $u ) or return ();
@@ -106,18 +103,12 @@ sub member_of_userids {
     return ()
         unless $u->is_person;
 
-    return @{ LJ::load_rel_target( $u, 'E' ) || [] }
-        if $args{force};
-
     return @{ LJ::load_rel_target_cache( $u, 'E' ) || [] };
 }
 *LJ::User::member_of_userids = \&member_of_userids;
 
 
 # returns array of userids that are our members
-# you may specify one argument "force => 1" if you are unwilling to take
-# potentially stale data.  otherwise, the results of this method may be up to
-# 30 minutes out of date.
 sub member_userids {
     my ( $u, %args ) = @_;
     $u = LJ::want_user( $u ) or return ();
@@ -125,10 +116,7 @@ sub member_userids {
     return ()
         unless $u->is_community;
 
-    return @{ LJ::load_rel_user( $u, 'E' ) || [] }
-        if $args{force};
-
-    return @{ LJ::load_rel_user( $u, 'E' ) || [] };
+    return @{ LJ::load_rel_user_cache( $u, 'E' ) || [] };
 }
 *LJ::User::member_userids = \&member_userids;
 
diff -r 59629336ae7a -r 65c6557a1e98 cgi-bin/ljrelation.pl
--- a/cgi-bin/ljrelation.pl	Wed Apr 01 04:58:44 2009 +0000
+++ b/cgi-bin/ljrelation.pl	Wed Apr 01 05:41:11 2009 +0000
@@ -246,8 +246,9 @@ sub _set_rel_memcache {
     LJ::MemCache::set($modukey, $now, $exp);
     LJ::MemCache::set($modtkey, $now, $exp);
 
-    # Also, delete this key, since the contents have changed.
+    # Also, delete these keys, since the contents have changed.
     LJ::MemCache::delete([$userid, "reluser:$userid:$type"]);
+    LJ::MemCache::delete([$targetid, "reluser_rev:$targetid:$type"]);
 
     return 1;
 }
--------------------------------------------------------------------------------