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
This commit is contained in:
Mike Frysinger 2019-06-13 12:42:39 -04:00
parent 9e71842fbf
commit 0c0e934b69

View File

@ -436,7 +436,7 @@ later is required to fix a server side protocol bug.
bare_git.gc('--auto') bare_git.gc('--auto')
return 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() threads = set()
sem = _threading.Semaphore(jobs) sem = _threading.Semaphore(jobs)
@ -598,7 +598,7 @@ later is required to fix a server side protocol bug.
self.jobs = opt.jobs self.jobs = opt.jobs
if self.jobs > 1: if self.jobs > 1:
soft_limit, _ = _rlimit_nofile() 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: if opt.network_only and opt.detach_head:
print('error: cannot combine -n and -d', file=sys.stderr) print('error: cannot combine -n and -d', file=sys.stderr)