my $next = {};
for my $ibx (values %$CLEANUP) {
my $again;
- foreach my $f (qw(mm search over)) {
- delete $ibx->{$f} if SvREFCNT($ibx->{$f}) == 1;
+ if ($have_devel_peek) {
- foreach my $f (qw(mm search)) {
++ foreach my $f (qw(mm search over)) {
+ # we bump refcnt by assigning tmp, here:
+ my $tmp = $ibx->{$f} or next;
+ next if Devel::Peek::SvREFCNT($tmp) > 2;
+ delete $ibx->{$f};
+ # refcnt is zero when tmp is out-of-scope
+ }
}
my $expire = time - 60;
if (my $git = $ibx->{git}) {
$again = 1 if $git->cleanup($expire);
}
}
- $again ||= !!($ibx->{over} || $ibx->{mm} || $ibx->{search});
+ if ($have_devel_peek) {
- $again ||= !!($ibx->{mm} || $ibx->{search});
++ $again ||= !!($ibx->{over} || $ibx->{mm} ||
++ $ibx->{search});
+ }
$next->{"$ibx"} = $ibx if $again;
}
$CLEANUP = $next;
use PublicInbox::MIME;
use PublicInbox::MID qw/id_compress/;
use PublicInbox::Over;
+ my $QP_FLAGS;
+ sub load_xapian () {
+ $QP_FLAGS ||= eval {
+ require Search::Xapian;
+ Search::Xapian->import(qw(:standard));
+
+ # n.b. FLAG_PURE_NOT is expensive not suitable for a public
+ # website as it could become a denial-of-service vector
++ # FLAG_PHRASE also seems to cause performance problems
++ # sometimes.
++ # TODO: make this an option, maybe?
++ # or make indexlevel=medium as default
+ FLAG_PHRASE()|FLAG_BOOLEAN()|FLAG_LOVEHATE()|FLAG_WILDCARD();
+ };
+ };
# This is English-only, everything else is non-standard and may be confused as
# a prefix common in patch emails