]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
(ext)index: move {todo} into $self
authorEric Wong <e@80x24.org>
Fri, 10 Jan 2025 23:20:10 +0000 (23:20 +0000)
committerEric Wong <e@80x24.org>
Tue, 14 Jan 2025 04:45:43 +0000 (04:45 +0000)
Another trivial field to `local'-ize and another step towards
eliminating the $sync structure.

lib/PublicInbox/ExtSearchIdx.pm
lib/PublicInbox/V2Writable.pm

index 21d91475cb2902cc323942d7fc4e96245d1d4ca7..6c578b3b6bfcb70b3f1bc7cb563a9cc25b56114c 100644 (file)
@@ -402,6 +402,7 @@ sub _sync_inbox ($$$) {
        $self->{nrec} = 0;
        local $self->{epoch_max};
        my $v = $ibx->version;
+       local $self->{todo}; # set by sync_prepare
        if ($v == 2) {
                $self->{epoch_max} = $ibx->max_git_epoch // return;
                sync_prepare($self, $sync); # or return # TODO: once MiscIdx is stable
@@ -412,11 +413,11 @@ sub _sync_inbox ($$$) {
                        return "E: $ibx->{inboxdir} is not indexed";
                my $stk = prepare_stack $self, $lc ? "$lc..$head" : $head;
                my $unit = { stack => $stk, git => $ibx->git };
-               push @{$sync->{todo}}, $unit;
+               push @{$self->{todo}}, $unit;
        } else {
                return "E: $ekey unsupported inbox version (v$v)";
        }
-       for my $unit (@{delete($sync->{todo}) // []}) {
+       for my $unit (@{delete($self->{todo}) // []}) {
                last if $self->{quit};
                index_todo($self, $sync, $unit);
        }
index e8d5e0052030b474c36a6a7a70e401ba660e159a..0bd49627fbee08702ce84df22bf96fbf04c5cea0 100644 (file)
@@ -965,7 +965,7 @@ sub sync_prepare ($$) {
                my $nr = $stk ? $stk->num_records : 0;
                $pr->("$nr\n") if $pr;
                $unit->{stack} = $stk; # may be undef
-               unshift @{$sync->{todo}}, $unit;
+               unshift @{$self->{todo}}, $unit;
                $regen_max += $nr;
        }
        return 0 if $self->{quit};
@@ -1228,10 +1228,8 @@ sub index_sync {
        $self->{oidx}->rethread_prepare($opt);
        local $self->{reindex} = $opt->{reindex};
        local $self->{mm_tmp};
-       my $sync = {
-               self => $self,
-               ibx => $self->{ibx},
-       };
+       local $self->{todo}; # sync_prepare
+       my $sync = { self => $self, ibx => $self->{ibx} };
        my $quit = PublicInbox::SearchIdx::quit_cb $self;
        local $SIG{QUIT} = $quit;
        local $SIG{INT} = $quit;
@@ -1254,7 +1252,7 @@ sub index_sync {
                }
        }
        # work forwards through history
-       index_todo($self, $sync, $_) for @{delete($sync->{todo}) // []};
+       index_todo($self, $sync, $_) for @{delete($self->{todo}) // []};
        $self->{oidx}->rethread_done($opt) unless $self->{quit};
        $self->done;