Mercurial > hg
changeset 30413:9c25a1a8c685
worker: change "pids" to a set
There is no need to keep any order of the "pids" array. A set is more
efficient for the "remove" operation. And the following patch will use that.
author | Jun Wu <quark@fb.com> |
---|---|
date | Tue, 15 Nov 2016 02:10:40 +0000 |
parents | 7bc25549e084 |
children | 5069a8a40b1b |
files | mercurial/worker.py |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/worker.py Thu Jul 28 20:57:07 2016 +0100 +++ b/mercurial/worker.py Tue Nov 15 02:10:40 2016 +0000 @@ -88,7 +88,7 @@ workers = _numworkers(ui) oldhandler = signal.getsignal(signal.SIGINT) signal.signal(signal.SIGINT, signal.SIG_IGN) - pids, problem = [], [0] + pids, problem = set(), [0] def killworkers(): # if one worker bails, there's no good reason to wait for the rest for p in pids: @@ -118,8 +118,7 @@ os._exit(255) # other exceptions are allowed to propagate, we rely # on lock.py's pid checks to avoid release callbacks - pids.append(pid) - pids.reverse() + pids.add(pid) os.close(wfd) fp = os.fdopen(rfd, 'rb', 0) t = threading.Thread(target=waitforworkers)