[Yum-devel] Fastest mirror selection plugin
Luke Macken
lmacken at redhat.com
Thu Nov 17 03:55:32 UTC 2005
On Wed, Nov 16, 2005 at 11:11:47PM +0200, Panu Matilainen wrote:
| Here's another variant of the plugin - this one figures out the fastest
| mirrors before metadata download which makes quite a difference
| especially on large updates:
| http://laiskiainen.org/yum/plugins/fastestmirror/fastestmirror-meta.py
Excellent -- I have been meaning to look into calculating the fastest
mirror earlier on in the process for a while now... no free time.
One minor issue with the code though; duplicate hosts still get added.
--- fastestmirror-meta.py.orig 2005-11-16 21:37:18.000000000 -0500
+++ fastestmirror-meta.py 2005-11-16 22:57:10.000000000 -0500
@@ -112,7 +112,7 @@
sock.connect((self.host, 80))
result = time.time() - time_before
sock.close()
- self.parent._add_result(self.mirror, self.host, result)
+ self.parent._add_result(self.mirror, self.host, result)
except:
if verbose:
print " * %s : dead" % self.host
| I guess access to the global timedhosts variable should be protected by
| locks... at work I use a nonthreaded version of the plugin because of
| weird problems with threads in kickstart %post so that hasn't been an
| issue.
As long as we're not modifying the timedhosts outside of the critical
section (which we're not), then it's probably not a *huge* deal --
worse case scenerio is that it looks for a duplicate host in the list
while it is being added and doesn't find it?. I'll leave it as-is for
now, and look in to that a bit later.
In the mean time, I updated my version and added a little bit of
documentation:
http://people.redhat.com/lmacken/fastestmirror.py
luke
More information about the Yum-devel
mailing list