]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Inbox.pm
view: more culling for search threads
[public-inbox.git] / lib / PublicInbox / Inbox.pm
index 706089caac1b5788edb386c7dbf3a17d7f9b9f80..d57e46d29b2785f5b358f125cdb8beda00e332ae 100644 (file)
@@ -17,6 +17,7 @@ eval {
        require PublicInbox::EvCleanup;
        $cleanup_timer = undef; # OK if we get here
 };
+my $cleanup_broken = $@;
 
 my $CLEANUP = {}; # string(inbox) -> inbox
 sub cleanup_task () {
@@ -31,6 +32,7 @@ sub cleanup_task () {
 
 sub _cleanup_later ($) {
        my ($self) = @_;
+       return if $cleanup_broken;
        return unless PublicInbox::EvCleanup::enabled();
        $cleanup_timer ||= PublicInbox::EvCleanup::later(*cleanup_task);
        $CLEANUP->{"$self"} = $self;
@@ -300,8 +302,9 @@ sub smsg_by_mid ($$) {
        my ($self, $mid) = @_;
        my $srch = search($self) or return;
        # favor the Message-ID we used for the NNTP article number:
-       my $num = mid2num($self, $mid);
-       defined $num ? $srch->lookup_article($num) : undef;
+       defined(my $num = mid2num($self, $mid)) or return;
+       my $smsg = $srch->lookup_article($num) or return;
+       PublicInbox::SearchMsg::psgi_cull($smsg);
 }
 
 sub msg_by_mid ($$;$) {