]> Sergey Matveev's repositories - public-inbox.git/commitdiff
extsearchidx: lock before writing multi-pack-index
authorEric Wong <e@80x24.org>
Wed, 30 Jun 2021 22:00:20 +0000 (22:00 +0000)
committerEric Wong <e@80x24.org>
Thu, 1 Jul 2021 20:28:43 +0000 (20:28 +0000)
This avoids errors from git in case -extindex gets invoked in
parallel.

lib/PublicInbox/ExtSearchIdx.pm

index e4eaf5be82fa753301ce573f85d016489d955f29..ee43e6f8f79f7e4de10b33a061c3dfc6eaf0f8ac 100644 (file)
@@ -1047,6 +1047,7 @@ sub idx_init { # similar to V2Writable
        $git_midx and $self->with_umask(sub {
                my @cmd = ('multi-pack-index');
                push @cmd, '--no-progress' if ($opt->{quiet}//0) > 1;
+               my $lk = $self->lock_for_scope;
                system('git', "--git-dir=$ALL", @cmd, 'write');
                # ignore errors, fairly new command, may not exist
        });