$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
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);
}
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};
$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;
}
}
# 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;