From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D89C1138331 for ; Sat, 21 Apr 2018 20:17:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F3A1CE07EA; Sat, 21 Apr 2018 20:17:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CCFACE07EA for ; Sat, 21 Apr 2018 20:17:11 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E7C8E335C7D for ; Sat, 21 Apr 2018 20:17:10 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 71386257 for ; Sat, 21 Apr 2018 20:17:09 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1524341799.3031af210e44af825096a7601fa368851428e661.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/CompositeTask.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 3031af210e44af825096a7601fa368851428e661 X-VCS-Branch: master Date: Sat, 21 Apr 2018 20:17:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a30d6dd6-97de-44e9-88e5-3149e1b685a5 X-Archives-Hash: e2ec323909d5779d86b6295f5129e80a commit: 3031af210e44af825096a7601fa368851428e661 Author: Zac Medico gentoo org> AuthorDate: Sat Apr 21 20:13:53 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Apr 21 20:16:39 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3031af21 CompositeTask._wait: recurse less (bug 591760) In order to reduce the amount of recursion, use a future to wait for task exit. Bug: https://bugs.gentoo.org/591760 pym/_emerge/CompositeTask.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pym/_emerge/CompositeTask.py b/pym/_emerge/CompositeTask.py index 40cf8596b..f3acc9696 100644 --- a/pym/_emerge/CompositeTask.py +++ b/pym/_emerge/CompositeTask.py @@ -82,7 +82,12 @@ class CompositeTask(AsynchronousTask): # a different task or None. Something is wrong. raise AssertionError("self._current_task has not " + \ "changed since calling wait", self, task) - task.wait() + + # This triggers less recursion than calling task.wait(). + waiter = self.scheduler.create_future() + task.addExitListener(waiter.set_result) + while not waiter.done(): + self.scheduler.iteration() prev = task return self.returncode