about summary refs log tree commit homepage
path: root/lib/PublicInbox/Inbox.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-25 22:16:45 +0000
committerEric Wong <e@80x24.org>2021-09-26 00:06:26 +0000
commit69225ecae508b9bb83960ac51e38d7d5eade2a6a (patch)
treed50e0ef5ad5322b42f63d03ba0b4576908ae35cb /lib/PublicInbox/Inbox.pm
parent71f6861703fde6f6687b002cd15c38cb7ef4a028 (diff)
downloadpublic-inbox-69225ecae508b9bb83960ac51e38d7d5eade2a6a.tar.gz
`undef' entries still take up a slot in the hash table, and
cause the `exists' check to false-positive in ->cleanup_shards.
This should fully fix the (innocuous) messages introduced in
commit 63d7b8ce (daemons: revamp periodic cleanup task, 2021-09-23)
Diffstat (limited to 'lib/PublicInbox/Inbox.pm')
-rw-r--r--lib/PublicInbox/Inbox.pm15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index c0962af9..3ba92c99 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -167,12 +167,12 @@ sub mm {
 
 sub search {
         my ($self) = @_;
-        my $srch = $self->{search} //= eval {
+        $self->{search} // eval {
                 _cleanup_later($self);
                 require PublicInbox::Search;
-                PublicInbox::Search->new($self);
+                my $srch = PublicInbox::Search->new($self);
+                (eval { $srch->xdb }) ? ($self->{search} = $srch) : undef;
         };
-        (eval { $srch->xdb }) ? $srch : undef;
 }
 
 # isrch is preferred for read-only interfaces if available since it
@@ -181,15 +181,14 @@ sub isrch { $_[0]->{isrch} // search($_[0]) }
 
 sub over {
         my ($self, $req) = @_;
-        $self->{over} //= eval {
-                my $srch = $self->{search} //= do {
-                        _cleanup_later($self);
+        $self->{over} // eval {
+                my $srch = $self->{search} // do {
                         require PublicInbox::Search;
                         PublicInbox::Search->new($self);
                 };
                 my $over = PublicInbox::Over->new("$srch->{xpfx}/over.sqlite3");
                 $over->dbh; # may fail
-                $over;
+                $self->{over} = $over;
         } // ($req ? croak("E: $@") : undef);
 }
 
@@ -293,7 +292,7 @@ sub imap_url { $_[0]->{-imap_url} //= _x_url($_[0], 'imap', $_[1]) }
 sub nntp_usable {
         my ($self) = @_;
         my $ret = mm($self) && over($self);
-        $self->{mm} = $self->{over} = $self->{search} = undef;
+        delete @$self{qw(mm over search)};
         $ret;
 }