]> Sergey Matveev's repositories - public-inbox.git/commitdiff
v2writable: move size check init to sync_prepare
authorEric Wong <e@80x24.org>
Tue, 27 Oct 2020 07:54:30 +0000 (07:54 +0000)
committerEric Wong <e@80x24.org>
Sat, 7 Nov 2020 10:21:42 +0000 (10:21 +0000)
This will let us use it from ExtSearchIdx.

lib/PublicInbox/V2Writable.pm

index ca60f2a16f88334eed088a363b6bf8a0b395ff96..d417b125b34066049bbdf0cd17408f1675b3dba6 100644 (file)
@@ -1038,6 +1038,9 @@ sub sync_prepare ($$) {
        # without {reindex}
        my $reindex_heads = $self->last_commits($sync) if $sync->{reindex};
 
+       if ($sync->{max_size} = $sync->{-opt}->{max_size}) {
+               $sync->{index_oid} = $self->can('index_oid');
+       }
        for (my $i = $sync->{epoch_max}; $i >= 0; $i--) {
                my $git_dir = $sync->{ibx}->git_dir_n($i);
                -d $git_dir or next; # missing epochs are fine
@@ -1312,9 +1315,6 @@ sub index_sync {
                        $art_beg++ if defined($art_beg);
                }
        }
-       if ($sync->{max_size} = $opt->{max_size}) {
-               $sync->{index_oid} = $self->can('index_oid');
-       }
        # work forwards through history
        index_epoch($self, $sync, $_) for (0..$epoch_max);
        $self->{oidx}->rethread_done($opt);