[livejournal] r23086: LJSUP-13866: [Internal]Requirements for ...
Committer: sbelyaev
LJSUP-13866: [Internal]Requirements for Redis module (v1.953)U trunk/cgi-bin/LJ/RelationService.pm U trunk/cgi-bin/LJ/S2.pm
Modified: trunk/cgi-bin/LJ/RelationService.pm
===================================================================
--- trunk/cgi-bin/LJ/RelationService.pm 2012-10-10 09:05:38 UTC (rev 23085)
+++ trunk/cgi-bin/LJ/RelationService.pm 2012-10-10 09:20:27 UTC (rev 23086)
@@ -75,8 +75,7 @@
}
my $interface = $class->relation_api($u);
- return $interface->find_relation_destinations($u, $type, %opts);
-
+ return $interface->find_relation_destinations($u, $type, %opts);
}
## findRelationSources
@@ -120,6 +119,7 @@
}
my $interface = $class->relation_api($u);
+ delete $singletons{$u->userid};
return $interface->load_relation_destinations($u, $type, %opts);
}
@@ -185,7 +185,7 @@
return undef unless $u && $friend && $type;
return $singletons{$u->userid}->{$friend->userid}->{$type}
- if exists $singletons{$u->userid}->{$friend->userid}->{$type};
+ if exists $singletons{$u->userid}->{$friend->userid}->{$type} && !%opts;
if ($class->_load_alt_api('read', $type)) {
my $alt = $class->alt_api($u);
@@ -237,6 +237,9 @@
return 0 unless $u && $friend && $type;
+ return $singletons{$u->userid}->{$friend->userid}->{gmask}
+ if exists $singletons{$u->userid}->{$friend->userid}->{gmask} && !%opts;
+
if ($class->_load_alt_api('read', $type)) {
my $alt = $class->alt_api($u);
if ($alt) {
@@ -245,7 +248,9 @@
}
my $interface = $class->relation_api($u);
- return $interface->get_groupmask($u, $friend, %opts);
+ my $result = $interface->get_groupmask($u, $friend, %opts);
+ $singletons{$u->userid}->{$friend->userid}->{gmask} = $result;
+ return $result;
}
sub delete_and_purge_completely {
@@ -265,6 +270,7 @@
}
my $interface = $class->relation_api($u);
+ delete $singletons{$u->userid};
return $interface->delete_and_purge_completely($u, %opts);
}
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm 2012-10-10 09:05:38 UTC (rev 23085)
+++ trunk/cgi-bin/LJ/S2.pm 2012-10-10 09:20:27 UTC (rev 23086)
@@ -4182,11 +4182,13 @@
my $etypeid = 'LJ::Event::JournalNewComment'->etypeid;
my $newentry_etypeid = 'LJ::Event::JournalNewEntry'->etypeid;
- my ($newentry_sub) = $remote ? $remote->has_subscription(
- journalid => $journalu->id,
- event => "JournalNewEntry",
- require_active => 1,
- ) : undef;
+ my $newentry_sub = $this->{__newentry_sub}->{$journalu->id} || undef;
+ if ($remote) {
+ ($newentry_sub) = $remote->has_subscription( journalid => $journalu->id,
+ event => "JournalNewEntry",
+ require_active => 1,);
+ $this->{__newentry_sub}->{$journalu->id} = $newentry_sub;
+ }
my $newentry_auth_token;
