]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei reindex: account for parallel lei/store users
authorEric Wong <e@80x24.org>
Fri, 19 Aug 2022 09:07:42 +0000 (09:07 +0000)
committerEric Wong <e@80x24.org>
Fri, 19 Aug 2022 18:46:45 +0000 (18:46 +0000)
We need to call eidx_init in each git->cat_async callback
since another requestor may've stopped the shard processes.

lib/PublicInbox/LeiStore.pm

index 277ed6bdaed7b646325e15bb9871ef0736363aae..8e710540f0345cc27f5aa127c60801df32523f70 100644 (file)
@@ -337,7 +337,8 @@ sub _docids_and_maybe_kw ($$) {
 
 sub _reindex_1 { # git->cat_async callback
        my ($bref, $hex, $type, $size, $smsg) = @_;
-       my ($self, $eidx, $tl) = delete @$smsg{qw(-self -eidx -tl)};
+       my $self = delete $smsg->{-sto};
+       my ($eidx, $tl) = eidx_init($self);
        $bref //= _lms_rw($self)->local_blob($hex, 1);
        if ($bref) {
                my $eml = PublicInbox::Eml->new($bref);
@@ -353,7 +354,7 @@ sub reindex_art {
        my ($eidx, $tl) = eidx_init($self);
        my $smsg = $eidx->{oidx}->get_art($art) // return;
        return if $smsg->{bytes} == 0; # external-only message
-       @$smsg{qw(-self -eidx -tl)} = ($self, $eidx, $tl);
+       $smsg->{-sto} = $self;
        $eidx->git->cat_async($smsg->{blob} // die("no blob (#$art)"),
                                \&_reindex_1, $smsg);
 }