]> Sergey Matveev's repositories - public-inbox.git/commitdiff
search: remove {over_ro} field
authorEric Wong <e@80x24.org>
Wed, 2 Sep 2020 11:04:17 +0000 (11:04 +0000)
committerEric Wong <e@80x24.org>
Thu, 3 Sep 2020 20:11:03 +0000 (20:11 +0000)
Only inbox accesses the read-only {over}, now, instead of going
through ->search.  This simplifies our object graph and avoids
potentially redundant FDs and DB handles pointing to the same
over.sqlite3 file.

lib/PublicInbox/Inbox.pm
lib/PublicInbox/Search.pm

index 241001d30924a04d6e16f8c8d14776ff88bc3a91..3b5ac970d07cf43af6d86b656d92606f108cefc9 100644 (file)
@@ -206,14 +206,13 @@ EOF
        };
 }
 
-sub over ($) {
-       my ($self) = @_;
-       my $srch = search($self, 1) or return;
-       $self->{over} //= eval {
-               my $over = $srch->{over_ro};
+sub over {
+       $_[0]->{over} //= eval {
+               my $srch = search($_[0], 1) or return;
+               my $over = PublicInbox::Over->new("$srch->{xpfx}/over.sqlite3");
                $over->dbh; # may fail
                $over;
-       }
+       };
 }
 
 sub try_cat {
index cfa942b2f75a794f3ed356bf743b7799b86dca72..b07f4ea6a7285315482ac79ec6a9d1de8f0bf8f3 100644 (file)
@@ -265,8 +265,6 @@ sub new {
                ibx_ver => $ibx->version,
        }, $class;
        xpfx_init($self);
-       my $dir = xdir($self, 1);
-       $self->{over_ro} = PublicInbox::Over->new("$dir/over.sqlite3");
        $self;
 }