From: Zac Medico Date: Tue, 29 Jul 2008 21:27:59 +0000 (-0000) Subject: Count state changes in Scheduler._schedule_tasks() and avoid some extra calls X-Git-Tag: v2.2_rc5~11 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=26a87d7e588b6ec5bacf0734985893fdc5adf5cf;p=portage.git Count state changes in Scheduler._schedule_tasks() and avoid some extra calls when nothing changes. svn path=/main/trunk/; revision=11273 --- diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 9629277a8..09ce0b7c5 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -9655,18 +9655,25 @@ class Scheduler(PollScheduler): def _schedule_tasks(self): remaining, state_change = self._schedule_tasks_imp() self._status_display.display() + + state_change = 0 for q in self._task_queues.values(): - q.schedule() + 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._jobs or self._task_queues.merge): + not (self._jobs or self._task_queues.merge) and \ + self._task_queues.fetch: self._task_queues.fetch.clear() + state_change += 1 - remaining, state_change = self._schedule_tasks_imp() - self._status_display.display() - return remaining + if state_change: + remaining, state_change = self._schedule_tasks_imp() + self._status_display.display() + + return bool(self._pkg_queue and not self._failed_pkgs) def _job_delay(self): """