Committer: sbelyaev
LJSUP-13883: Journal pages optimizaiton : stage 1U trunk/cgi-bin/LJ/NotificationInbox.pm
Modified: trunk/cgi-bin/LJ/NotificationInbox.pm =================================================================== --- trunk/cgi-bin/LJ/NotificationInbox.pm 2012-10-12 13:30:12 UTC (rev 23127) +++ trunk/cgi-bin/LJ/NotificationInbox.pm 2012-10-12 13:59:49 UTC (rev 23128) @@ -196,9 +196,9 @@ my $u = $self->owner; - my $count = LJ::MemCache::get($self->_count_memkey); - unless ($count) { - $count = $u->selectrow_array + my $count = LJ::MemCache::get($self->_count_memkey) ; + unless (defined $count) { + $count = $u->selectrow_array ("SELECT COUNT(*) FROM notifyqueue WHERE userid=?", undef, $u->id); LJ::MemCache::set($self->_count_memkey, $count, 3600); @@ -395,6 +395,7 @@ # Get list of bookmarks and ignore them when checking inbox limits my $bmarks = join ',', $self->get_bookmarks_ids; my $bookmark_sql = ($bmarks) ? "AND qid NOT IN ($bmarks) " : ''; + my $too_old_qid = $u->selectrow_array ("SELECT qid FROM notifyqueue ". "WHERE userid=? $bookmark_sql".