aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-08-20 20:37:53 (GMT)
committerZac Medico <zmedico@gentoo.org>2012-08-20 20:37:53 (GMT)
commit31b41fe7a20e6e0d19ff2383a746d61d8aa18b50 (patch)
tree71826bf7ac651353548ff16916942897aa7242b8
parentmake.conf.5: warn about PORTAGE_TMPDIR in PORTDIR (diff)
downloadportage-31b41fe7a20e6e0d19ff2383a746d61d8aa18b50.zip
portage-31b41fe7a20e6e0d19ff2383a746d61d8aa18b50.tar.gz
portage-31b41fe7a20e6e0d19ff2383a746d61d8aa18b50.tar.bz2
Scheduler: only use poll timeout when needed
This avoids wasteful CPU consumption, as reported in bug #432024.
-rw-r--r--pym/_emerge/Scheduler.py9
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