From 91b253ba2f249b19d6cc68f51cd6b909a765a715 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 8 Oct 2012 13:44:22 -0700 Subject: [PATCH] PollScheduler: disable default _loadavg_latency Move the 30 second default to the Scheduler class, since that's the only place that it's currently needed (all other schedulers have relatively short-running jobs). --- pym/_emerge/PollScheduler.py | 2 +- pym/_emerge/Scheduler.py | 7 ++++++- pym/portage/util/_async/AsyncScheduler.py | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/PollScheduler.py b/pym/_emerge/PollScheduler.py index 1a81e2d17..d02b0dafc 100644 --- a/pym/_emerge/PollScheduler.py +++ b/pym/_emerge/PollScheduler.py @@ -15,7 +15,7 @@ from _emerge.getloadavg import getloadavg class PollScheduler(object): # max time between loadavg checks (milliseconds) - _loadavg_latency = 30000 + _loadavg_latency = None def __init__(self, main=False, event_loop=None): """ diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 40033c2c3..3b55b2bdb 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -66,6 +66,9 @@ if sys.hexversion >= 0x3000000: class Scheduler(PollScheduler): + # max time between loadavg checks (milliseconds) + _loadavg_latency = 30000 + # max time between display status updates (milliseconds) _max_display_latency = 3000 @@ -1339,7 +1342,9 @@ class Scheduler(PollScheduler): def _main_loop(self): term_check_id = self._event_loop.idle_add(self._termination_check) loadavg_check_id = None - if self._max_load is not None: + if self._max_load is not None and \ + self._loadavg_latency is not None and \ + (self._max_jobs is True or self._max_jobs > 1): # We have to schedule periodically, in case the load # average has changed since the last call. loadavg_check_id = self._event_loop.timeout_add( diff --git a/pym/portage/util/_async/AsyncScheduler.py b/pym/portage/util/_async/AsyncScheduler.py index c6a37f59e..182e19ee8 100644 --- a/pym/portage/util/_async/AsyncScheduler.py +++ b/pym/portage/util/_async/AsyncScheduler.py @@ -66,7 +66,9 @@ class AsyncScheduler(AsynchronousTask, PollScheduler): def _start(self): self._term_check_id = self._event_loop.idle_add(self._termination_check) - if self._max_load is not None: + if self._max_load is not None and \ + self._loadavg_latency is not None and \ + (self._max_jobs is True or self._max_jobs > 1): # We have to schedule periodically, in case the load # average has changed since the last call. self._loadavg_check_id = self._event_loop.timeout_add( -- 2.26.2