about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiImportKw.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-19 12:50:26 +0000
committerEric Wong <e@80x24.org>2021-09-19 19:52:48 +0000
commit46001a7685f11cfe2b9263b0eb38478c8e951585 (patch)
tree02f29067755ce1430290bce777fb4073abf2dd54 /lib/PublicInbox/LeiImportKw.pm
parentee355020415fbbebbeb8fbe79be4e4f3fa2e657b (diff)
downloadpublic-inbox-46001a7685f11cfe2b9263b0eb38478c8e951585.tar.gz
"All" my CPUs is only 4, but it's probably ridiculous for
somebody with a 16-core system to have 16 processes for
accessing SQLite DBs.

We do the same thing in Pmdir for parallel Maildir access
(and V2Writable).
Diffstat (limited to 'lib/PublicInbox/LeiImportKw.pm')
-rw-r--r--lib/PublicInbox/LeiImportKw.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiImportKw.pm b/lib/PublicInbox/LeiImportKw.pm
index 2863d17f..379101c2 100644
--- a/lib/PublicInbox/LeiImportKw.pm
+++ b/lib/PublicInbox/LeiImportKw.pm
@@ -11,7 +11,9 @@ use parent qw(PublicInbox::IPC);
 sub new {
         my ($cls, $lei) = @_;
         my $self = bless { -wq_ident => 'lei import_kw worker' }, $cls;
-        my ($op_c, $ops) = $lei->workers_start($self, $self->detect_nproc);
+        my $j = $self->detect_nproc // 4;
+        $j = 4 if $j > 4;
+        my ($op_c, $ops) = $lei->workers_start($self, $j);
         $op_c->{ops} = $ops; # for PktOp->event_step
         $self->{lei_sock} = $lei->{sock};
         $lei->{ikw} = $self;