]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
v2writable: eliminate $sync->{art_end}
authorEric Wong <e@80x24.org>
Fri, 10 Jan 2025 23:20:05 +0000 (23:20 +0000)
committerEric Wong <e@80x24.org>
Tue, 14 Jan 2025 04:45:39 +0000 (04:45 +0000)
Instead of creating a long-lived {art_end} entry or even
local-izing it in $self, pass the `$art_end' value on stack to
achieve symmetry with the existing `$arg_beg' arg in calls to
index_xap_step().

lib/PublicInbox/V2Writable.pm

index 0606c99f371d16d2993d27c62c1dabf698312b62..4e42b347aa5968df9a8061e02873ecc34272d0ef 100644 (file)
@@ -1095,9 +1095,8 @@ sub index_xap_only { # git->cat_async callback
        $idx->index_eml(PublicInbox::Eml->new($bref), $smsg);
 }
 
-sub index_xap_step ($$$;$) {
-       my ($self, $sync, $beg, $step) = @_;
-       my $end = $sync->{art_end};
+sub index_xap_step ($$$$;$) {
+       my ($self, $sync, $beg, $end, $step) = @_;
        return if $beg > $end; # nothing to do
 
        $step //= $self->{shards};
@@ -1177,18 +1176,18 @@ sub xapian_only ($;$$) {
        if (my $art_end = $self->{ibx}->mm->max) {
                $self->{-regen_fmt} //= "%u/?\n";
                $sync //= { self => $self };
-               $sync->{art_end} = $art_end;
                if ($seq || !$self->{parallel}) {
                        my $shard_end = $self->{shards} - 1;
                        for my $i (0..$shard_end) {
                                last if $self->{quit};
-                               index_xap_step($self, $sync, $art_beg + $i);
+                               index_xap_step $self, $sync, $art_beg + $i,
+                                               $art_end;
                                if ($i != $shard_end) {
                                        reindex_checkpoint($self, $sync);
                                }
                        }
                } else { # parallel (maybe)
-                       index_xap_step($self, $sync, $art_beg, 1);
+                       index_xap_step $self, $sync, $art_beg, $art_end, 1;
                }
        }
        $self->git->async_wait_all;