* [PATCH 2/2] lei_query: avoid POSIX::lround for older Perls
2021-04-20 19:02 5% ` [PATCH 0/2] CentOS 7 fixes Eric Wong
@ 2021-04-20 19:02 7% ` Eric Wong
1 sibling, 0 replies; 2+ results
From: Eric Wong @ 2021-04-20 19:02 UTC (permalink / raw)
To: meta
POSIX.pm shipped with Perl 5.16.3 did not support lround,
at least. So just rely on built-in core functions.
---
lib/PublicInbox/LeiQuery.pm | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index 385ba0a9..f51dc93b 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) = @_;
@@ -22,7 +21,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/) {
@@ -36,8 +35,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
^ permalink raw reply related [relevance 7%]
* [PATCH 0/2] CentOS 7 fixes
@ 2021-04-20 19:02 5% ` Eric Wong
2021-04-20 19:02 7% ` [PATCH 2/2] lei_query: avoid POSIX::lround for older Perls Eric Wong
1 sibling, 0 replies; 2+ results
From: Eric Wong @ 2021-04-20 19:02 UTC (permalink / raw)
To: meta
Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> t/admin.t .................... Warning: Use of "ref" without parentheses is ambiguous at /usr/local/share/public-inbox/blib/lib/PublicInbox/TestCommon.pm line 28.
> Use of ?PATTERN? without explicit operator is deprecated at /usr/local/share/public-inbox/blib/lib/PublicInbox/TestCommon.pm line 28.
> Global symbol "$path" requires explicit package name at /usr/local/share/public-inbox/blib/lib/PublicInbox/TestCommon.pm line 28.
> Global symbol "$cb" requires explicit package name at /usr/local/share/public-inbox/blib/lib/PublicInbox/TestCommon.pm line 28.
>
> Backing up to 64b1ce9f94127fc144d6205bb572fe43b4b552c2 makes tests pass.
Oops, 1/2 should fix it. Thanks for the report.
I also noticed lei was totally broken once I tried a more recent git.
Eric Wong (2):
test_common: fix xbail for Perl 5.16
lei_query: avoid POSIX::lround for older Perls
lib/PublicInbox/LeiQuery.pm | 6 ++----
lib/PublicInbox/TestCommon.pm | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-04-20 17:49 c1b912dea25 breaks make test on CentOS7 Konstantin Ryabitsev
2021-04-20 19:02 5% ` [PATCH 0/2] CentOS 7 fixes Eric Wong
2021-04-20 19:02 7% ` [PATCH 2/2] lei_query: avoid POSIX::lround for older Perls Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).