[Request] [+ ] D8927: posixworker: avoid creating workers that end up getting no work
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Aug 13 17:45:44 UTC 2020
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
If `workers` (the detected or configured number of CPUs) is greater
than the number of work items, then some of the workers end up getting
0 work items. Let's not create such workers.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D8927
AFFECTED FILES
mercurial/worker.py
CHANGE DETAILS
diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -211,7 +211,7 @@
parentpid = os.getpid()
pipes = []
retval = {}
- for pargs in partition(args, workers):
+ for pargs in partition(args, min(workers, len(args))):
# Every worker gets its own pipe to send results on, so we don't have to
# implement atomic writes larger than PIPE_BUF. Each forked process has
# its own pipe's descriptors in the local variables, and the parent
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200813/82a47879/attachment.html>
More information about the Mercurial-patches
mailing list