]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/V2Writable.pm
searchidx: log2stack: simplify callers
[public-inbox.git] / lib / PublicInbox / V2Writable.pm
index f8b7abe1c8aeac2574b53d92b4368db9bdaf2361..a403f22feb2220eaca68b3ea6b58016a7e6b9e0b 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;
@@ -1049,7 +1051,7 @@ sub sync_prepare ($$$) {
                # because we want NNTP article number gaps from unindexed
                # messages to show up in mirrors, too.
                $sync->{D} //= $sync->{reindex} ? {} : undef; # OID_BIN => NR
-               my $stk = log2stack($sync, $git, $range, $sync->{ibx});
+               my $stk = log2stack($sync, $git, $range);
                my $nr = $stk ? $stk->num_records : 0;
                $pr->("$nr\n") if $pr;
                $sync->{stacks}->[$i] = $stk if $stk;