diff options
author | Eric Wong <e@80x24.org> | 2023-04-07 12:40:51 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-04-07 22:17:21 +0000 |
commit | 39b99c2514230f419fae8c2b52a7d55eaad1cd44 (patch) | |
tree | 9fd91da5f74839b307bfc42147f797849bc46be3 /lib/PublicInbox/ExtSearchIdx.pm | |
parent | 1fc59b952c8e9618abad4ec52888e43f55b8ab77 (diff) | |
download | public-inbox-39b99c2514230f419fae8c2b52a7d55eaad1cd44.tar.gz |
This lets us get rid of some awkwardness around the old API and single-use subroutines while saving us some LoC.
Diffstat (limited to 'lib/PublicInbox/ExtSearchIdx.pm')
-rw-r--r-- | lib/PublicInbox/ExtSearchIdx.pm | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 6f3711ba..6856ae66 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -1179,12 +1179,6 @@ sub update_last_commit { # overrides V2Writable $self->{oidx}->eidx_meta($meta_key, $latest_cmt); } -sub _idx_init { # with_umask callback - my ($self, $opt) = @_; - PublicInbox::V2Writable::_idx_init($self, $opt); # acquires ei.lock - $self->{midx} = PublicInbox::MiscIdx->new($self); -} - sub symlink_packs ($$) { my ($ibx, $pd) = @_; my $ret = 0; @@ -1270,15 +1264,17 @@ sub idx_init { # similar to V2Writable } ($has_new || $prune_nr || $new ne '') and $self->{mg}->write_alternates($mode, $alt, $new); - $git_midx and $self->with_umask(sub { + my $restore = $self->with_umask; + if ($git_midx) { 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 - }); + } $self->parallel_init($self->{indexlevel}); - $self->with_umask(\&_idx_init, $self, $opt); + PublicInbox::V2Writable::_idx_init($self, $opt); # acquires ei.lock + $self->{midx} = PublicInbox::MiscIdx->new($self); $self->{oidx}->begin_lazy; $self->{oidx}->eidx_prep; $self->{midx}->create_xdb if $new ne ''; |