diff options
-rw-r--r-- | lib/PublicInbox/ExtSearchIdx.pm | 3 | ||||
-rw-r--r-- | t/extsearch.t | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index fb1f511e..22edbb4b 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -52,7 +52,8 @@ sub new { parallel => 1, lock_path => "$dir/ei.lock", }, __PACKAGE__; - $self->{shards} = $self->count_shards || nproc_shards($opt->{creat}); + $self->{shards} = $self->count_shards || + nproc_shards({ nproc => $opt->{jobs} }); my $oidx = PublicInbox::OverIdx->new("$self->{xpfx}/over.sqlite3"); $self->{-no_fsync} = $oidx->{-no_fsync} = 1 if !$opt->{fsync}; $self->{oidx} = $oidx; diff --git a/t/extsearch.t b/t/extsearch.t index 46a6f2ec..1f62e80c 100644 --- a/t/extsearch.t +++ b/t/extsearch.t @@ -411,4 +411,15 @@ if ('dedupe + dry-run') { '--dry-run alone fails'); } +for my $j (1, 3, 6) { + my $o = { 2 => \(my $err = '') }; + my $d = "$home/extindex-j$j"; + ok(run_script(['-extindex', "-j$j", '--all', $d], undef, $o), + "init with -j$j"); + my $max = $j - 2; + $max = 0 if $max < 0; + my @dirs = glob("$d/ei*/?"); + like($dirs[-1], qr!/ei[0-9]+/$max\z!, '-j works'); +} + done_testing; |