From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id CC44F138010 for ; Mon, 20 Aug 2012 20:38:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 164BEE07F6; Mon, 20 Aug 2012 20:38:14 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D950BE07F6 for ; Mon, 20 Aug 2012 20:38:13 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1BB651B4223 for ; Mon, 20 Aug 2012 20:38:13 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D0A45E543D for ; Mon, 20 Aug 2012 20:38:11 +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: <1345495073.31b41fe7a20e6e0d19ff2383a746d61d8aa18b50.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/Scheduler.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 31b41fe7a20e6e0d19ff2383a746d61d8aa18b50 X-VCS-Branch: master Date: Mon, 20 Aug 2012 20:38:11 +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: ae76963d-4ba7-44fa-9bb4-3f2b6baf90ad X-Archives-Hash: 825e683ef5f9233e570948a9f9730903 commit: 31b41fe7a20e6e0d19ff2383a746d61d8aa18b50 Author: Zac Medico gentoo org> AuthorDate: Mon Aug 20 20:37:53 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Aug 20 20:37:53 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=31b41fe7 Scheduler: only use poll timeout when needed This avoids wasteful CPU consumption, as reported in bug #432024. --- pym/_emerge/Scheduler.py | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 0b72a4c..d40cedd 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -1351,8 +1351,10 @@ class Scheduler(PollScheduler): failed_pkgs = self._failed_pkgs portage.locks._quiet = self._background portage.elog.add_listener(self._elog_listener) - display_timeout_id = self.sched_iface.timeout_add( - self._max_display_latency, self._status_display.display) + display_timeout_id = None + if self._status_display._isatty and not self._status_display.quiet: + display_timeout_id = self.sched_iface.timeout_add( + self._max_display_latency, self._status_display.display) rval = os.EX_OK try: @@ -1361,7 +1363,8 @@ class Scheduler(PollScheduler): self._main_loop_cleanup() portage.locks._quiet = False portage.elog.remove_listener(self._elog_listener) - self.sched_iface.source_remove(display_timeout_id) + if display_timeout_id is not None: + self.sched_iface.source_remove(display_timeout_id) if failed_pkgs: rval = failed_pkgs[-1].returncode