summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-06-24 01:18:12 -0700
committerZac Medico <zmedico@gentoo.org>2012-06-24 01:18:12 -0700
commitfe03b5fd790fc09bd6594c55bb174e80aaac1e5a (patch)
tree09744157623704c0419b4a2548d4c0d569fae988
parent7216350dc54b891d1909ffa7d9fceb52f1de04a7 (diff)
downloadportage-fe03b5fd790fc09bd6594c55bb174e80aaac1e5a.tar.gz
portage-fe03b5fd790fc09bd6594c55bb174e80aaac1e5a.tar.bz2
portage-fe03b5fd790fc09bd6594c55bb174e80aaac1e5a.zip
PollScheduler: schedule inside loop if max_load
This will fix a case like that reported in bug #403895, triggered when the --load-average option is used.
-rw-r--r--pym/_emerge/PollScheduler.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pym/_emerge/PollScheduler.py b/pym/_emerge/PollScheduler.py
index 965dc20ee..5103e31d6 100644
--- a/pym/_emerge/PollScheduler.py
+++ b/pym/_emerge/PollScheduler.py
@@ -148,15 +148,22 @@ class PollScheduler(object):
def _main_loop(self):
term_check_id = self.sched_iface.idle_add(self._termination_check)
try:
- # Populate initial event sources. We only need to do
- # this once here, since it can be called during the
- # loop from within event handlers.
+ # Populate initial event sources. Unless we're scheduling
+ # based on load average, we only need to do this once
+ # here, since it can be called during the loop from within
+ # event handlers.
self._schedule()
+ max_load = self._max_load
# Loop while there are jobs to be scheduled.
while self._keep_scheduling():
self.sched_iface.iteration()
+ if max_load is not None:
+ # We have to schedule periodically, in case the load
+ # average has changed since the last call.
+ self._schedule()
+
# Clean shutdown of previously scheduled jobs. In the
# case of termination, this allows for basic cleanup
# such as flushing of buffered output to logs.