Decrement the job count prior to merging a given package (after it's been
authorZac Medico <zmedico@gentoo.org>
Sun, 13 Jul 2008 01:10:45 +0000 (01:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 13 Jul 2008 01:10:45 +0000 (01:10 -0000)
built or extracted). This will allow additional jobs to spawn sooner in
some cases when there may be idle resources.

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

pym/_emerge/__init__.py

index c382cc801a3425fe87aae03dafb6553e0ce9f1d0..14c1466659fb2062340fa7d96e1d073e0beb9b1e 100644 (file)
@@ -8654,7 +8654,8 @@ class Scheduler(PollScheduler):
 
        def _merge_exit(self, merge):
                self._do_merge_exit(merge)
-               self._job_exit(merge.merge)
+               self._deallocate_config(merge.merge.settings)
+               self._schedule()
 
        def _do_merge_exit(self, merge):
                pkg = merge.merge.pkg
@@ -8691,19 +8692,15 @@ class Scheduler(PollScheduler):
                        merge = PackageMerge(merge=build)
                        merge.addExitListener(self._merge_exit)
                        self._task_queues.merge.add(merge)
-                       self._task_queues.merge.schedule()
                else:
                        self._failed_pkgs.append((build.pkg, build.returncode))
-                       self._job_exit(build)
+                       self._deallocate_config(build.settings)
+               self._jobs -= 1
+               self._schedule()
 
        def _extract_exit(self, build):
                self._build_exit(build)
 
-       def _job_exit(self, job):
-               self._jobs -= 1
-               self._deallocate_config(job.settings)
-               self._schedule()
-
        def _merge(self):
 
                self._add_prefetchers()
@@ -8827,15 +8824,16 @@ class Scheduler(PollScheduler):
 
                        task = self._task(pkg, background)
 
-                       self._jobs += 1
                        if pkg.installed:
                                merge = PackageMerge(merge=task)
                                merge.addExitListener(self._merge_exit)
                                task_queues.merge.add(merge)
                        elif pkg.built:
+                               self._jobs += 1
                                task.addExitListener(self._extract_exit)
                                task_queues.jobs.add(task)
                        else:
+                               self._jobs += 1
                                task.addExitListener(self._build_exit)
                                task_queues.jobs.add(task)
                return True