[yum-commits] urlgrabber/grabber.py
zpavlas at osuosl.org
zpavlas at osuosl.org
Mon Aug 27 07:45:01 UTC 2012
urlgrabber/grabber.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit 501c3690593e3439c0462a2b35ccb3616889ff97
Author: ZdenÄk Pavlas <zpavlas at redhat.com>
Date: Mon Aug 27 09:25:24 2012 +0200
timedhosts: defer 1st update until a 1MB+ download. BZ 851178
First speed update throws away initial mirror order, so better
do that only if the guess is not completely random.
diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index ffd5a10..daa478d 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -2332,17 +2332,19 @@ class _TH:
@staticmethod
def update(url, dl_size, dl_time, ug_err, baseurl=None):
- _TH.load()
-
# Use hostname from URL. If it's a file:// URL, use baseurl.
# If no baseurl, do not update timedhosts.
host = urlparse.urlsplit(url).netloc.split('@')[-1] or baseurl
if not host: return
+ _TH.load()
speed, fail, ts = _TH.hosts.get(host) or (0, 0, 0)
now = time.time()
if ug_err is None:
+ # defer first update if the file was small. BZ 851178.
+ if not ts and dl_size < 1e6: return
+
# k1: the older, the less useful
# k2: <500ms readings are less reliable
# speeds vary, use 10:1 smoothing
More information about the Yum-commits
mailing list