]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Inbox.pm
fix syntax warnings
[public-inbox.git] / lib / PublicInbox / Inbox.pm
index f000a950e48b2754a54fb8477ace9de34c106712..666c81d7125cc68e7166e1249edcb2fec0376bdf 100644 (file)
@@ -29,6 +29,7 @@ sub cleanup_task () {
 
 sub _cleanup_later ($) {
        my ($self) = @_;
+       return unless PublicInbox::EvCleanup::enabled();
        $cleanup_timer ||= PublicInbox::EvCleanup::later(*cleanup_task);
        $CLEANUP->{"$self"} = $self;
 }
@@ -74,7 +75,7 @@ sub new {
        _set_uint($opts, 'feedmax', 25);
        $opts->{nntpserver} ||= $pi_config->{'publicinbox.nntpserver'};
        my $dir = $opts->{mainrepo};
-       if (defined $dir && -f "$dir/msgmap.sqlite3") { # XXX DIRTY
+       if (defined $dir && -f "$dir/inbox.lock") {
                $opts->{version} = 2;
        }
        bless $opts, $class;
@@ -254,9 +255,11 @@ sub msg_by_mid ($$;$) {
        my ($self, $mid, $ref) = @_;
        my $srch = search($self) or
                        return msg_by_path($self, mid2path($mid), $ref);
-       my $smsg = $srch->lookup_skeleton($mid) or return;
-       $smsg->load_expand;
-       msg_by_smsg($self, $smsg, $ref);
+       my $smsg;
+       $srch->retry_reopen(sub {
+               $smsg = $srch->lookup_skeleton($mid) and $smsg->load_expand;
+       });
+       $smsg ? msg_by_smsg($self, $smsg, $ref) : undef;
 }
 
 1;