Skip to content

Commit

Permalink
Memcache save bug was breaking read the rest of the comment
Browse files Browse the repository at this point in the history
Full text was getting saved to the chopped value memchace var because
the conditional did not include the check to see if we were working on
a full text search.

$possible_chop can’t include the check for full as there is a special
check needed when reading the memcache for looking at full values.
  • Loading branch information
paulej72 committed May 24, 2015
1 parent 2876a07 commit 5aa765e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Slash/DB/MySQL/MySQL.pm
Expand Up @@ -6461,12 +6461,7 @@ sub getCommentTextCached {
last if $plen >= $this_max_len + 256; # rest getting cut anyway
}
}
} else {
# If we're chopping, chop plenty, not just a bit.
# This lets the rest of the comment actually be more than just a few lines or sometime none.
$this_len = int($this_len * $fuzzy_length);
}

$abbrev_text = chopEntity($abbrev_text, $this_len);

# the comments have already gone through approveTag
Expand Down Expand Up @@ -6561,13 +6556,13 @@ sub getCommentTextCached {
if (defined $comments->{$cid}{abbreviated}) {
$append = $comments->{$cid}{abbreviated} . ':';
$mcdkey_cid = $mcdkey_abbrev . $cid;
} elsif (!$possible_chop) {
} elsif (!$possible_chop || ($opt->{cid} && $opt->{cid} eq $cid)) {
$mcdkey_cid = $mcdkey_full . $cid;
}
my $retval = $mcd->set($mcdkey_cid, $append . $comment_text->{$cid}, $exptime);
if ($mcd && $constants->{memcached_debug} && $constants->{memcached_debug} > 1) {
my $exp_at = $exptime ? scalar(gmtime(time + $exptime)) : "never";
print STDERR scalar(gmtime) . " getCommentTextCached memcached writing '$mcdkey$cid' length " . length($comment_text->{$cid}) . " retval=$retval expire: $exp_at\n";
print STDERR scalar(gmtime) . " getCommentTextCached memcached writing '$mcdkey_cid' length " . length($comment_text->{$cid}) . " retval=$retval expire: $exp_at\n";
}
}
}
Expand Down

0 comments on commit 5aa765e

Please sign in to comment.