[yum-commits] urlgrabber/grabber.py
zpavlas at osuosl.org
zpavlas at osuosl.org
Tue Oct 1 13:28:55 UTC 2013
urlgrabber/grabber.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
New commits:
commit f2a33c7c2fef7a8266e3a5753e3ae573b873264e
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date: Tue Oct 1 15:25:05 2013 +0200
clamp timestamps from the future. BZ 894630, 1013733
The previous fix was incomplete. Only update() path was fixed,
but not the estimate() path. By moving the code that clamps
timestamps to the loader, we fix both.
diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index 63baef7..9252977 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -2355,9 +2355,10 @@ class _TH:
filename = default_grabber.opts.timedhosts
if filename and _TH.dirty is None:
try:
+ now = int(time.time())
for line in open(filename):
host, speed, fail, ts = line.rsplit(' ', 3)
- _TH.hosts[host] = int(speed), int(fail), int(ts)
+ _TH.hosts[host] = int(speed), int(fail), min(int(ts), now)
except IOError: pass
_TH.dirty = False
@@ -2389,9 +2390,6 @@ class _TH:
if ug_err is None:
# defer first update if the file was small. BZ 851178.
if not ts and dl_size < 1e6: return
- # clamp timestamps from the future. BZ 894630.
- if ts > now: ts = now
-
# 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