From: Zac Medico Date: Thu, 8 Jul 2010 00:56:14 +0000 (-0700) Subject: Make Scheduler._schedule_tasks() use a loop to ensure that _merge_wait_queue X-Git-Tag: v2.2_rc68~534 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e6e5e028a15071bbaeca808cc518b4feb52e844a;p=portage.git Make Scheduler._schedule_tasks() use a loop to ensure that _merge_wait_queue is emptied whenever possible. --- 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):