about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchIdx.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-10-27 07:54:24 +0000
committerEric Wong <e@80x24.org>2020-11-07 10:18:56 +0000
commite0ee07820a1b580ee1b755c9f9ec3c87e00727d9 (patch)
tree060806539b0348b5563b0b4fe923e108d114f7af /lib/PublicInbox/SearchIdx.pm
parent549aab226464e93345b466bbf5ae04d952230945 (diff)
downloadpublic-inbox-e0ee07820a1b580ee1b755c9f9ec3c87e00727d9.tar.gz
This will allow reusability with ExtSearchIdx
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r--lib/PublicInbox/SearchIdx.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 029b2726..d3c904c7 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -785,9 +785,9 @@ sub log2stack ($$$$) {
         $stk->read_prepare;
 }
 
-sub prepare_stack ($$$) {
-        my ($self, $sync, $range) = @_;
-        my $git = $self->{ibx}->git;
+sub prepare_stack ($$) {
+        my ($sync, $range) = @_;
+        my $git = $sync->{ibx}->git;
 
         if (index($range, '..') < 0) {
                 # don't show annoying git errors to users who run -index
@@ -796,7 +796,7 @@ sub prepare_stack ($$$) {
                 return PublicInbox::IdxStack->new->read_prepare if $?;
         }
         $sync->{D} = $sync->{reindex} ? {} : undef; # OID_BIN => NR
-        log2stack($sync, $git, $range, $self->{ibx});
+        log2stack($sync, $git, $range, $sync->{ibx});
 }
 
 # --is-ancestor requires git 1.8.0+
@@ -848,11 +848,11 @@ sub reindex_from ($$) {
 sub _index_sync {
         my ($self, $opt) = @_;
         my $tip = $opt->{ref} || 'HEAD';
-        my $git = $self->{ibx}->git;
+        my $ibx = $self->{ibx};
         $self->{batch_bytes} = $opt->{batch_size} // $BATCH_BYTES;
-        $git->batch_prepare;
+        $ibx->git->batch_prepare;
         my $pr = $opt->{-progress};
-        my $sync = { reindex => $opt->{reindex}, -opt => $opt };
+        my $sync = { reindex => $opt->{reindex}, -opt => $opt, ibx => $ibx };
         my $xdb = $self->begin_txn_lazy;
         $self->{oidx}->rethread_prepare($opt);
         my $mm = _msgmap_init($self);
@@ -870,7 +870,7 @@ sub _index_sync {
         my $lx = reindex_from($sync->{reindex}, $last_commit);
         my $range = $lx eq '' ? $tip : "$lx..$tip";
         $pr->("counting changes\n\t$range ... ") if $pr;
-        my $stk = prepare_stack($self, $sync, $range);
+        my $stk = prepare_stack($sync, $range);
         $sync->{ntodo} = $stk ? $stk->num_records : 0;
         $pr->("$sync->{ntodo}\n") if $pr; # continue previous line
         process_stack($self, $sync, $stk);