From e414834041d39f14211ede7df8ec5ff527673967 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 8 Feb 2012 17:58:28 -0800 Subject: [PATCH] Scheduler: tweak _add_prefetchers Since commit 4620d6aba1c5c10344e311585516ee43819b703c, the first prefetcher is started as soon as it's added to the task queue. --- pym/_emerge/Scheduler.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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): """ -- 2.26.2