[yum-cvs] yum-utils/plugins/fastestmirror ChangeLog, 1.1, 1.2 fastestmirror.py, 1.3, 1.4

Luke Macken lmacken at linux.duke.edu
Tue Feb 7 03:14:56 UTC 2006


Update of /home/groups/yum/cvs/yum-utils/plugins/fastestmirror
In directory login1.linux.duke.edu:/tmp/cvs-serv24234

Modified Files:
	ChangeLog fastestmirror.py 
Log Message:
* Feb 06 2006 Luke Macken <lmacken at redhat.com> - 0.2.4
- Only write the timedhost file if we've re-pinged the mirrors



Index: ChangeLog
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/plugins/fastestmirror/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ChangeLog	2 Feb 2006 21:25:14 -0000	1.1
+++ ChangeLog	7 Feb 2006 03:14:54 -0000	1.2
@@ -1,3 +1,6 @@
+* Feb 06 2006 Luke Macken <lmacken at redhat.com> - 0.2.4
+- Only write the timedhost file if we've re-pinged the mirrors
+
 * Feb 02 2006 Luke Macken <lmacken at redhat.com> - 0.2.3
 - Added 'maxhostfileage' option to specify how many days to keep the hostfile
 

Index: fastestmirror.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/plugins/fastestmirror/fastestmirror.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- fastestmirror.py	2 Feb 2006 21:25:14 -0000	1.3
+++ fastestmirror.py	7 Feb 2006 03:14:54 -0000	1.4
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Version: 0.2.3
+# Version: 0.2.4
 #
 # A plugin for the Yellowdog Updater Modified which sorts each repo's
 # mirrorlist by connection speed prior to metadata download.
@@ -50,18 +50,21 @@
 timedhosts = {}
 hostfilepath = ''
 maxhostfileage = 10
+loadcache = False
 
 def init_hook(conduit):
-    global verbose, socket_timeout, hostfilepath, maxhostfileage
+    global verbose, socket_timeout, hostfilepath, maxhostfileage, loadcache
     verbose = conduit.confBool('main', 'verbose', default=False)
     socket_timeout = conduit.confInt('main', 'socket_timeout', default=3)
     hostfilepath = conduit.confString('main', 'hostfilepath',
             default='/var/cache/yum/timedhosts')
     maxhostfileage = conduit.confInt('main', 'maxhostfileage', default=10)
+    if os.path.exists(hostfilepath) and get_hostfile_age() < maxhostfileage:
+        loadcache = True
 
 def postreposetup_hook(conduit):
-    global hostfilepath, maxhostfileage
-    if os.path.exists(hostfilepath) and get_hostfile_age() < maxhostfileage:
+    global loadcache
+    if loadcache:
         conduit.info(2, "Loading mirror speeds from cached hostfile")
         read_timedhosts()
     else:
@@ -75,7 +78,8 @@
         repo.set('failovermethod', 'priority')
         repo.check()
         repo.setupGrab()
-    write_timedhosts()
+    if not loadcache:
+        write_timedhosts()
 
 def read_timedhosts():
     global timedhosts




More information about the Yum-cvs-commits mailing list