From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 343D91F884 for ; Sun, 2 Feb 2020 06:52:23 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/9] v2writable: do not clobber {shards} or {parallel} if unset Date: Sun, 2 Feb 2020 06:52:16 +0000 Message-Id: <20200202065222.14966-4-e@yhbt.net> In-Reply-To: <20200202065222.14966-1-e@yhbt.net> References: <20200202065222.14966-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The $jobs parameter in `public-inbox-convert' is passed to V2Writable->init_inbox as `undef' by default, causing parallelization to be disabled. Instead, leave the underlying {parallel} flag untouched if $shards is undef and do not clobber the default shard count. This allows us to take advantage of multicore systems when running public-inbox-convert with no command-line switches. --- lib/PublicInbox/V2Writable.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 37d27302..72d8d5af 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -107,8 +107,11 @@ sub new { # public (for now?) sub init_inbox { - my ($self, $parallel, $skip_epoch) = @_; - $self->{parallel} = $parallel; + my ($self, $shards, $skip_epoch) = @_; + if (defined $shards) { + $self->{parallel} = 0 if $shards == 0; + $self->{shards} = $shards if $shards > 0; + } $self->idx_init; my $epoch_max = -1; git_dir_latest($self, \$epoch_max);