[yum-git] plugins/fastestmirror

James Antill james at linux.duke.edu
Thu Jul 3 13:50:28 UTC 2008


 plugins/fastestmirror/fastestmirror.py |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit e7998f755cfc2da2c730b008c8ad078fa1ada181
Author: James Antill <james at and.org>
Date:   Thu Jul 3 09:50:25 2008 -0400

    Skip testing mirrors twice, when postreposetup_hook() is called twice

diff --git a/plugins/fastestmirror/fastestmirror.py b/plugins/fastestmirror/fastestmirror.py
index 13a35d2..afd3f5a 100644
--- a/plugins/fastestmirror/fastestmirror.py
+++ b/plugins/fastestmirror/fastestmirror.py
@@ -60,6 +60,7 @@ loadcache = False
 maxthreads = 15
 exclude = None
 done_sock_timeout = False
+done_repos = set()
 
 def init_hook(conduit):
     """
@@ -145,7 +146,9 @@ def postreposetup_hook(conduit):
     if conduit._base.conf.cache or not _can_write_results(hostfilepath):
         return
 
-    if loadcache:
+    if done_repos:
+        conduit.info(2, "Checking for new repos for mirrors")
+    elif loadcache:
         conduit.info(2, "Loading mirror speeds from cached hostfile")
         read_timedhosts()
     else:
@@ -157,6 +160,8 @@ def postreposetup_hook(conduit):
     # parallelism as possible (if we need to do the network tests).
     all_urls = []
     for repo in repos.listEnabled():
+        if repo.id in done_repos:
+            continue
         if len(repo.urls) == 1:
             continue
         all_urls.extend(repo.urls)
@@ -164,6 +169,8 @@ def postreposetup_hook(conduit):
 
     #  This should now just be looking up the cached times.
     for repo in repos.listEnabled():
+        if repo.id in done_repos:
+            continue
         if len(repo.urls) == 1:
             continue
         if not repomirrors.has_key(str(repo)):
@@ -180,6 +187,7 @@ def postreposetup_hook(conduit):
         repo.failovermethod = 'priority'
         repo.check()
         repo.setupGrab()
+        done_repos.add(repo.id)
     if done_sock_timeout:
         socket.setdefaulttimeout(None)
 



More information about the Yum-cvs-commits mailing list