]> Sergey Matveev's repositories - public-inbox.git/commitdiff
v2writable: checkpoint: account for lack of {mm}
authorEric Wong <e@80x24.org>
Tue, 27 Oct 2020 07:54:19 +0000 (07:54 +0000)
committerEric Wong <e@80x24.org>
Sat, 7 Nov 2020 10:18:49 +0000 (10:18 +0000)
ExtSearchIdx will not have Msgmap, since it may index
non email blobs in the future (it'll still be usable
with IMAP, but not NNTP).

lib/PublicInbox/V2Writable.pm

index f8b7abe1c8aeac2574b53d92b4368db9bdaf2361..867e4d2b0556c19ddc45e27f382df9819b93a3a4 100644 (file)
@@ -609,10 +609,11 @@ sub checkpoint ($;$) {
        }
        my $shards = $self->{idx_shards};
        if ($shards) {
-               my $dbh = $self->{mm}->{dbh};
+               my $mm = $self->{mm};
+               my $dbh = $mm->{dbh} if $mm;
 
                # SQLite msgmap data is second in importance
-               $dbh->commit;
+               $dbh->commit if $dbh;
 
                # SQLite overview is third
                $self->{oidx}->commit_lazy;
@@ -632,11 +633,12 @@ sub checkpoint ($;$) {
 
                # last_commit is special, don't commit these until
                # Xapian shards are done:
-               $dbh->begin_work;
+               $dbh->begin_work if $dbh;
                set_last_commits($self);
-               $dbh->commit;
-
-               $dbh->begin_work;
+               if ($dbh) {
+                       $dbh->commit;
+                       $dbh->begin_work;
+               }
        }
        $self->{total_bytes} += $self->{transact_bytes};
        $self->{transact_bytes} = 0;