about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-09-02 11:04:17 +0000
committerEric Wong <e@80x24.org>2020-09-03 20:11:03 +0000
commit53c1b42f1f8bf5b50acbf25cbe77e70ca15d5c77 (patch)
treec425afe0d88ef2a16e790ad9628480a302117d0e
parent80b887f29b2ec71d025b4c266a1c26314758994c (diff)
downloadpublic-inbox-53c1b42f1f8bf5b50acbf25cbe77e70ca15d5c77.tar.gz
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.
-rw-r--r--lib/PublicInbox/Inbox.pm11
-rw-r--r--lib/PublicInbox/Search.pm2
2 files changed, 5 insertions, 8 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 241001d3..3b5ac970 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -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 {
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index cfa942b2..b07f4ea6 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -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;
 }