unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] lei pmdir: fix nproc for <= 4 CPUs
@ 2021-06-08 23:56 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2021-06-08 23:56 UTC (permalink / raw)
  To: meta

I forgot my FreeBSD VM has 8 cores, actually, and tweaked the
nproc detection on that machine before finalizing commit
10b523eb017162240b1ac3647f8dcbbf2be348a7
("lei import: speed up repeated Maildir imports")

Fixes: 10b523eb01716224 ("lei import: speed up repeated Maildir imports")
---
 lib/PublicInbox/LeiPmdir.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/LeiPmdir.pm b/lib/PublicInbox/LeiPmdir.pm
index 5efb012e..b71efe70 100644
--- a/lib/PublicInbox/LeiPmdir.pm
+++ b/lib/PublicInbox/LeiPmdir.pm
@@ -13,14 +13,14 @@ use parent qw(PublicInbox::IPC);
 sub new {
 	my ($cls, $lei, $ipt) = @_;
 	my $self = bless { -wq_ident => 'lei Maildir worker' }, $cls;
-	my $jobs = $lei->{opt}->{jobs};
+	my $jobs = $lei->{opt}->{jobs} // '';
 	$jobs =~ /\A[0-9]+,([0-9]+)\z/ and $jobs = $1;
-	my $nproc = $jobs // do {
-		# untested with >=4 CPUs, though I suspect I/O latency
+	my $nproc = $jobs || do {
+		# barely tested with >=4 CPUs, though I suspect I/O latency
 		# of SATA SSD storage will make >=4 processes unnecessary,
 		# here.  NVMe users may wish to use '-j'
 		my $n = $self->detect_nproc;
-		$n = 4 if $n > 4;
+		$n = $n > 4 ? 4 : $n;
 	};
 	my ($op_c, $ops) = $lei->workers_start($self, $nproc,
 		undef, { ipt => $ipt }); # LeiInput subclass

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-08 23:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 23:56 [PATCH] lei pmdir: fix nproc for <= 4 CPUs Eric Wong

unofficial mirror of meta@public-inbox.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://yhetil.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.mail.public-inbox.meta
	nntp://news.public-inbox.org/inbox.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git