Split out a _main_loop_cleanup() method from Scheduler._merge() and call it
authorZac Medico <zmedico@gentoo.org>
Tue, 15 Jul 2008 00:50:13 +0000 (00:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 15 Jul 2008 00:50:13 +0000 (00:50 -0000)
before restarting in _restart_if_necessary() to kill any parallel-fetch tasks
that may still be running.

svn path=/main/trunk/; revision=11050

pym/_emerge/__init__.py

index b80f60c69db9484ac5bdd4e146b3b3ab82ea6ae5..a2c7b19e7c01961cc2ad8f6b3f5ae9f2113961d6 100644 (file)
@@ -8730,6 +8730,8 @@ class Scheduler(PollScheduler):
                if self._pkg_count.curval >= self._pkg_count.maxval:
                        return
 
+               self._main_loop_cleanup()
+
                logger = self._logger
                pkg_count = self._pkg_count
                mtimedb = self._mtimedb
@@ -8902,12 +8904,7 @@ class Scheduler(PollScheduler):
                try:
                        self._main_loop()
                finally:
-                       # discard remaining packages if necessary
-                       del pkg_queue[:]
-                       self._completed_tasks.clear()
-                       self._digraph = None
-                       self._task_queues.fetch.clear()
-
+                       self._main_loop_cleanup()
                        # discard any failures and return the
                        # exist status of the last one
                        if failed_pkgs:
@@ -8917,6 +8914,12 @@ class Scheduler(PollScheduler):
 
                return rval
 
+       def _main_loop_cleanup(self):
+               del self._pkg_queue[:]
+               self._completed_tasks.clear()
+               self._digraph = None
+               self._task_queues.fetch.clear()
+
        def _choose_pkg(self):
                """
                Choose a task that has all it's dependencies satisfied.