about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-12 11:47:02 +0000
committerEric Wong <e@80x24.org>2021-10-12 21:46:35 +0000
commit212578b82ad3cb28b2d18f36c656be56a27fd5bc (patch)
tree577a809a501dccae0c9ec250656e1dac699141d3 /lib
parent83d92d71381e08ec84eafb28ff29193955aa80c3 (diff)
downloadpublic-inbox-212578b82ad3cb28b2d18f36c656be56a27fd5bc.tar.gz
We still need to account for msgmap being open all the time
and not having separate read-only vs. read-write packages.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Msgmap.pm19
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/PublicInbox/Msgmap.pm b/lib/PublicInbox/Msgmap.pm
index de9fd989..978730e2 100644
--- a/lib/PublicInbox/Msgmap.pm
+++ b/lib/PublicInbox/Msgmap.pm
@@ -257,21 +257,10 @@ sub skip_artnum {
 
 sub check_inodes {
         my ($self) = @_;
-        # no filename if in-:memory:
-        my $f = $self->{dbh}->sqlite_db_filename // return;
-        if (my @st = stat($f)) { # did st_dev, st_ino change?
-                my $st = pack('dd', $st[0], $st[1]);
-                if ($st ne ($self->{st} // $st)) {
-                        my $tmp = eval { ref($self)->new_file($f) };
-                        if ($@) {
-                                warn "E: DBI->connect($f): $@\n";
-                        } else {
-                                %$self = %$tmp;
-                        }
-                }
-        } else {
-                warn "W: stat $f: $!\n";
-        }
+        $self->{dbh} // return;
+        my $rw = !$self->{dbh}->{ReadOnly};
+        PublicInbox::Over::check_inodes($self);
+        $self->{dbh} //= PublicInbox::Over::dbh_new($self, !$rw);
 }
 
 1;