about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-04-21 00:02:06 +0500
committerEric Wong <e@80x24.org>2021-04-20 16:49:35 -0400
commit41d3b34eb617927131e619de3ed16bd3981a9b66 (patch)
tree9c459ce212534240ed05169b4bebf315ba4d18ea
parenta39ff6488d3f88873fdf6170507f84a234b01f14 (diff)
downloadpublic-inbox-master.tar.gz
POSIX.pm shipped with Perl 5.16.3 did not support lround,
at least.  So just rely on built-in core functions.
-rw-r--r--lib/PublicInbox/LeiQuery.pm6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index 4099b26c..efe328cc 100644
--- a/lib/PublicInbox/LeiQuery.pm
+++ b/lib/PublicInbox/LeiQuery.pm
@@ -5,7 +5,6 @@
 package PublicInbox::LeiQuery;
 use strict;
 use v5.10.1;
-use POSIX ();
 
 sub prep_ext { # externals_each callback
         my ($lxs, $exclude, $loc) = @_;
@@ -23,7 +22,7 @@ sub _start_query { # used by "lei q" and "lei up"
         }
         my $lxs = $self->{lxs};
         $xj ||= $lxs->concurrency($opt); # allow: "--jobs ,$WRITER_ONLY"
-        my $nproc = $lxs->detect_nproc // 1; # don't memoize, schedtool(1) exists
+        my $nproc = $lxs->detect_nproc || 1; # don't memoize, schedtool(1) exists
         $xj = $nproc if $xj > $nproc;
         $lxs->{-wq_nr_workers} = $xj;
         if (defined($mj) && $mj !~ /\A[1-9][0-9]*\z/) {
@@ -37,8 +36,7 @@ sub _start_query { # used by "lei q" and "lei up"
                 $self->_lei_store(1)->write_prepare($self);
         }
         $l2m and $l2m->{-wq_nr_workers} = $mj // do {
-                $mj = POSIX::lround($nproc * 3 / 4); # keep some CPU for git
-                $mj <= 0 ? 1 : $mj;
+                $mj = int($nproc * 0.75 + 0.5); # keep some CPU for git
         };
 
         # descending docid order is cheapest, MUA controls sorting order