From 0c0e934b699cd4b6da623c208069c4ca40a0c405 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 13 Jun 2019 12:42:39 -0400 Subject: [PATCH] sync: use integer division with job counts Neither of the fields here expect floats so make sure we use integer division when calculating things. Bug: https://crbug.com/gerrit/10418 Change-Id: Ibda068b16a7bba7ff3efba442c4bbff4415caa6e --- subcmds/sync.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subcmds/sync.py b/subcmds/sync.py index 2e92584e..02cd3879 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -436,7 +436,7 @@ later is required to fix a server side protocol bug. bare_git.gc('--auto') return - config = {'pack.threads': cpu_count / jobs if cpu_count > jobs else 1} + config = {'pack.threads': cpu_count // jobs if cpu_count > jobs else 1} threads = set() sem = _threading.Semaphore(jobs) @@ -598,7 +598,7 @@ later is required to fix a server side protocol bug. self.jobs = opt.jobs if self.jobs > 1: soft_limit, _ = _rlimit_nofile() - self.jobs = min(self.jobs, (soft_limit - 5) / 3) + self.jobs = min(self.jobs, (soft_limit - 5) // 3) if opt.network_only and opt.detach_head: print('error: cannot combine -n and -d', file=sys.stderr)