]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Inbox.pm
nntp: speed up mid_lookup() using ->ALL extindex
[public-inbox.git] / lib / PublicInbox / Inbox.pm
index 1d18cdf17ddd162e5ed26f295a186fa14bb1485a..5a22e40d086acf5d0b96333aa23a907328a28216 100644 (file)
@@ -133,10 +133,10 @@ sub new {
 sub version { $_[0]->{version} // 1 }
 
 sub git_epoch {
-       my ($self, $epoch) = @_;
-       $self->version == 2 or return;
+       my ($self, $epoch) = @_; # v2-only, callers always supply $epoch
        $self->{"$epoch.git"} ||= do {
                my $git_dir = "$self->{inboxdir}/git/$epoch.git";
+               return unless -d $git_dir;
                my $g = PublicInbox::Git->new($git_dir);
                $g->{-httpbackend_limiter} = $self->{-httpbackend_limiter};
                # no cleanup needed, we never cat-file off this, only clone
@@ -429,4 +429,6 @@ sub on_unlock {
 
 sub uidvalidity  { $_[0]->{uidvalidity} //= $_[0]->mm->created_at }
 
+sub eidx_key { $_[0]->{newsgroup} // $_[0]->{inboxdir} }
+
 1;