From 53c1b42f1f8bf5b50acbf25cbe77e70ca15d5c77 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 2 Sep 2020 11:04:17 +0000 Subject: [PATCH] search: remove {over_ro} field 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 | 11 +++++------ lib/PublicInbox/Search.pm | 2 -- 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; } -- 2.44.0