Binpkg: use fetch queue to cap fetch threads
authorZac Medico <zmedico@gentoo.org>
Sun, 17 Jul 2011 00:04:08 +0000 (17:04 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 17 Jul 2011 00:04:08 +0000 (17:04 -0700)
This is analogous to commit f07f8386e945b48358c11c121960e4833c539752
for bug #375331, but for fetching from binhosts.

pym/_emerge/Binpkg.py

index b83341941ed74d709affd544e4563006daf837f2..bc6511e73ca3751d57a47a08fe9e65c0572e595d 100644 (file)
@@ -126,7 +126,12 @@ class Binpkg(CompositeTask):
                        short_msg = "emerge: (%s of %s) %s Fetch" % \
                                (pkg_count.curval, pkg_count.maxval, pkg.cpv)
                        self.logger.log(msg, short_msg=short_msg)
-                       self._start_task(fetcher, self._fetcher_exit)
+
+                       # Allow the Scheduler's fetch queue to control the
+                       # number of concurrent fetchers.
+                       fetcher.addExitListener(self._fetcher_exit)
+                       self._task_queued(fetcher)
+                       self.scheduler.fetch.schedule(fetcher)
                        return
 
                self._fetcher_exit(fetcher)