summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-07-07 17:56:14 -0700
committerZac Medico <zmedico@gentoo.org>2010-07-07 17:56:14 -0700
commite6e5e028a15071bbaeca808cc518b4feb52e844a (patch)
treebed3d150360eb84cd5cc4124b57ca4a6d00d9d96
parenta38c4e082649051cd6823bd8ab96c67130e94a82 (diff)
downloadportage-e6e5e028a15071bbaeca808cc518b4feb52e844a.tar.gz
portage-e6e5e028a15071bbaeca808cc518b4feb52e844a.tar.bz2
portage-e6e5e028a15071bbaeca808cc518b4feb52e844a.zip
Make Scheduler._schedule_tasks() use a loop to ensure that _merge_wait_queue
is emptied whenever possible.
-rw-r--r--pym/_emerge/Scheduler.py50
1 files changed, 26 insertions, 24 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index a6368fcb4..94391fc8d 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -1459,35 +1459,37 @@ class Scheduler(PollScheduler):
def _schedule_tasks(self):
- # When the number of jobs drops to zero, process all waiting merges.
- if not self._jobs and self._merge_wait_queue:
- for task in self._merge_wait_queue:
- task.addExitListener(self._merge_wait_exit_handler)
- self._task_queues.merge.add(task)
- self._status_display.merges = len(self._task_queues.merge)
- self._merge_wait_scheduled.extend(self._merge_wait_queue)
- del self._merge_wait_queue[:]
-
- self._schedule_tasks_imp()
- self._status_display.display()
-
- state_change = 0
- for q in self._task_queues.values():
- if q.schedule():
- state_change += 1
+ while True:
- # Cancel prefetchers if they're the only reason
- # the main poll loop is still running.
- if self._failed_pkgs and not self._build_opts.fetchonly and \
- not self._is_work_scheduled() and \
- self._task_queues.fetch:
- self._task_queues.fetch.clear()
- state_change += 1
+ # When the number of jobs drops to zero, process all waiting merges.
+ if not self._jobs and self._merge_wait_queue:
+ for task in self._merge_wait_queue:
+ task.addExitListener(self._merge_wait_exit_handler)
+ self._task_queues.merge.add(task)
+ self._status_display.merges = len(self._task_queues.merge)
+ self._merge_wait_scheduled.extend(self._merge_wait_queue)
+ del self._merge_wait_queue[:]
- if state_change:
self._schedule_tasks_imp()
self._status_display.display()
+ state_change = 0
+ for q in self._task_queues.values():
+ if q.schedule():
+ state_change += 1
+
+ # Cancel prefetchers if they're the only reason
+ # the main poll loop is still running.
+ if self._failed_pkgs and not self._build_opts.fetchonly and \
+ not self._is_work_scheduled() and \
+ self._task_queues.fetch:
+ self._task_queues.fetch.clear()
+ state_change += 1
+
+ if not (state_change or \
+ (not self._jobs and self._merge_wait_queue)):
+ break
+
return self._keep_scheduling()
def _job_delay(self):