PollScheduler: return None from _schedule_tasks
authorZac Medico <zmedico@gentoo.org>
Sat, 11 Feb 2012 20:05:17 +0000 (12:05 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 11 Feb 2012 20:05:17 +0000 (12:05 -0800)
The _keep_scheduling() template method is used instead.

pym/_emerge/MetadataRegen.py
pym/_emerge/PollScheduler.py
pym/_emerge/Scheduler.py

index 3404001194e84a2debd3f1ed1398ad4b6574a12c..efe300421601d3fdb6d00c2b2f6aa978a39de32b 100644 (file)
@@ -139,27 +139,21 @@ class MetadataRegen(PollScheduler):
                                                pass
 
        def _schedule_tasks(self):
-               """
-               @rtype: bool
-               @returns: True if there may be remaining tasks to schedule,
-                       False otherwise.
-               """
                if self._terminated_tasks:
-                       return False
+                       return
 
                while self._can_add_job():
                        try:
                                metadata_process = next(self._process_iter)
                        except StopIteration:
                                self._remaining_tasks = False
-                               return False
+                               return
 
                        self._jobs += 1
                        self._running_tasks.add(metadata_process)
                        metadata_process.scheduler = self.sched_iface
                        metadata_process.addExitListener(self._metadata_exit)
                        metadata_process.start()
-               return True
 
        def _metadata_exit(self, metadata_process):
                self._jobs -= 1
index 3b3ef67df1038c9b334795445180306659b1f010..e270e6ad0a38130ad8c5498ddaa6b0374efc3c34 100644 (file)
@@ -70,6 +70,14 @@ class PollScheduler(object):
                """
                raise NotImplementedError()
 
+       def _keep_scheduling(self):
+               """
+               @rtype: bool
+               @returns: True if there may be remaining tasks to schedule,
+                       False otherwise.
+               """
+               return False
+
        def _schedule_tasks(self):
                """
                This is called from inside the _schedule() method, which
@@ -83,7 +91,7 @@ class PollScheduler(object):
                Unless this method is used to perform user interface updates,
                or something like that, the first thing it should do is check
                the state of _terminated_tasks and if that is True then it
-               should return False immediately (since there's no need to
+               should return immediately (since there's no need to
                schedule anything after _terminate_tasks() has been called).
                """
                pass
@@ -105,7 +113,7 @@ class PollScheduler(object):
                                self._terminated_tasks = True
                                self._terminate_tasks()
 
-                       return self._schedule_tasks()
+                       self._schedule_tasks()
                finally:
                        self._scheduling = False
 
@@ -125,9 +133,6 @@ class PollScheduler(object):
                while self._is_work_scheduled():
                        self.sched_iface.iteration()
 
-       def _keep_scheduling(self):
-               return False
-
        def _is_work_scheduled(self):
                return bool(self._running_job_count())
 
index 66d76b1e07f9887de042f4bff3f24842eff52aa6..5bb4fe83a32334de2168902003a9b5e0d8a54d83 100644 (file)
@@ -1542,8 +1542,6 @@ class Scheduler(PollScheduler):
                                not self._task_queues.merge)):
                                break
 
-               return self._keep_scheduling()
-
        def _job_delay(self):
                """
                @rtype: bool