about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-09-29 02:44:06 +0000
committerEric Wong <e@80x24.org>2023-09-29 06:58:09 +0000
commit3f3abf8152cdf4c0ba0dec4e1dc4f7e173633e54 (patch)
tree9ed6982c775267f8908304922d1ffdb5f01bd703 /lib/PublicInbox/Git.pm
parent5df0446abcca8ca3d65af14f05808c87d3de5b7f (diff)
downloadpublic-inbox-3f3abf8152cdf4c0ba0dec4e1dc4f7e173633e54.tar.gz
Unlike C, Perl automatically converts quotients to double-precision
floating point even with UV/IV numerators and denominators.  So
force the intermediate quotient to be an integer before
multiplying it by the size of each inflight array element.

This bug was inconsequential for all platforms since d4ba8828ab23f278
(git: fix asynchronous batching for deep pipelines, 2023-01-04)
and inconsequential on most (or all?) Linux even before that due
to the larger 4096-byte PIPE_BUF on Linux.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 764e38d7..53887e3d 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -35,10 +35,10 @@ my @MODIFIED_DATE = qw[for-each-ref --sort=-committerdate
                         --format=%(committerdate:raw) --count=1];
 
 # 512: POSIX PIPE_BUF minimum (see pipe(7))
-# 3: @$inflight is flattened [ $OID, $cb, $arg ]
 # 65: SHA-256 hex size + "\n" in preparation for git using non-SHA1
+# 3: @$inflight is flattened [ $OID, $cb, $arg ]
 use constant {
-        MAX_INFLIGHT => 512 * 3 / (65 + length('contents ')),
+        MAX_INFLIGHT => int(512 / (65 + length('contents '))) * 3,
         BATCH_CMD_VER => v2.36.0, # git 2.36+
 };