From: Zac Medico Date: Thu, 9 Feb 2012 01:58:28 +0000 (-0800) Subject: Scheduler: tweak _add_prefetchers X-Git-Tag: v2.2.0_alpha86~35 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e414834041d39f14211ede7df8ec5ff527673967;p=portage.git Scheduler: tweak _add_prefetchers Since commit 4620d6aba1c5c10344e311585516ee43819b703c, the first prefetcher is started as soon as it's added to the task queue. --- diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index d3f77611d..6502f71c5 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -733,15 +733,13 @@ class Scheduler(PollScheduler): continue prefetcher = self._create_prefetcher(pkg) if prefetcher is not None: - self._task_queues.fetch.add(prefetcher) + # This will start the first prefetcher immediately, so that + # self._task() won't discard it. This avoids a case where + # the first prefetcher is discarded, causing the second + # prefetcher to occupy the fetch queue before the first + # fetcher has an opportunity to execute. prefetchers[pkg] = prefetcher - - # Start the first prefetcher immediately so that self._task() - # won't discard it. This avoids a case where the first - # prefetcher is discarded, causing the second prefetcher to - # occupy the fetch queue before the first fetcher has an - # opportunity to execute. - self._task_queues.fetch.schedule() + self._task_queues.fetch.add(prefetcher) def _create_prefetcher(self, pkg): """